<?php

if (! defined('ABSPATH')) exit; // Exit if accessed directly

?>
<?php
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET parameter used for layout mode detection only
$instant_popup_builder_is_edit_mode = isset($_GET['edit_id']) && !empty(sanitize_text_field(wp_unslash($_GET['edit_id'])));
$instant_popup_builder_sound_section_classes = 'ipb-section ipb-sound-settings';
if (! $instant_popup_builder_is_edit_mode) {
    $instant_popup_builder_sound_section_classes .= ' ipb-new-popup-panel';
}
?>
<div class="<?php echo esc_attr($instant_popup_builder_sound_section_classes); ?>">
 <div class="ipb-section-header">
    <h3>Sound Effects</h3>
</div>
<div class="ipb-section-content" data-section="display">
<div class="design_background">
    <div class="ipb_background_wrapper ipb_sound_wrapper">

        <div class="background_field sound_wrap" id="action_wrapper">
            <div class="toggle">
                <div class="sound_inputs">
                    <label for="sound_open">Popup opening sound</label>
                    <div class="input toggle switch">
                        <input type="checkbox" name="sound_open" id="sound_open" value="no">
                        <span class="slider round"></span>
                    </div>
                </div>
                <p class="ipb-sound-helper">Enable to play a sound when the popup opens.</p>
                <div class="sound_inputs">
                    <label for="sound_close">Popup closing sound</label>
                    <div class="input toggle switch">
                        <input type="checkbox" name="sound_close" id="sound_close" value="no">
                        <span class="slider round"></span>
                    </div>
                </div>
                <p class="ipb-sound-helper">Enable to play a sound when the popup closes.</p>
            </div>
            <div class="sounds">
                <div class="sound_input" id="sound_opening_file" style="display: none;">
                        <h3>Choose Opening Sound</h3>
                        <div class="sound_fields">
                        <i class="fa-solid fa-cloud-arrow-up"></i>
                        <input type="file" name="sound_open_file" id="sound_open_file" style="display:none;" type="/mp3">
                        <input type="hidden" name="sound_open_url" class="sound_hidden" id="sound_open_url">
                        <label for="">Upload</label>
                       <audio  class="audio_file" controls style="display: none;">
                           <source src="#" type="audio/mp3">
                        </audio>
                    </div>
                    <div class="sound_fields">
                        <audio id="audioOpen" class="audio_file" src="<?php echo esc_url(plugin_dir_url(dirname(dirname(dirname(__FILE__)))) . 'assets/uploads/sound.mp3'); ?>" display="none"></audio>
                        <div class="play">
                            <i class="fa-solid fa-volume-low"></i>
                            <div class="controls">
                                <i class="fa-solid fa-play"></i>
                            </div>
                        </div>
                        <label for="">Test</label>
                    </div>
                </div>
                <div class="sound_input" id="sound_close_file" style="display: none;">
                    <h3>Choose Closing Sound</h3>
                    <div class="sound_fields">
                        <i class="fa-solid fa-cloud-arrow-up"></i>
                        <input type="file" name="sound_closing_file" id="sound_closing_file" style="display:none;" type="/mp3">
                        <input type="hidden" name="sound_closing_url" class="sound_hidden" id="sound_closing_url">
                        <label for="">Upload</label>
                         <audio  class="audio_file" controls style="display: none;">
                           <source src="#" type="audio/mp3">
                        </audio>
                    </div>
                    <div class="sound_fields">
                        <audio id="audioClose" class="audio_file" src="<?php echo esc_url(plugin_dir_url(dirname(dirname(dirname(__FILE__)))) . 'assets/uploads/sound.mp3'); ?>" display="none"></audio>
                        <div class="play">
                            <i class="fa-solid fa-volume-low"></i>
                            <div class="controls">
                                <i class="fa-solid fa-play"></i>
                            </div>
                        </div>
                        <label for="">Test</label>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</div>