<div class="container-fluid">
    <div>
        <h3>AI Settings</h3>
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a href="#">Home</a>
                </li>
                <li class="breadcrumb-item">
                    <a href="#">Settings</a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">AI Settings</li>
            </ol>
        </nav>
    </div>
    <!-- Vertical Layout -->
    <div class="row">
        <div class="col-lg-6 col-md-6">
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">Open AI settings</h6>
                    <form class="email-settings" method="POST">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">OpenAI API key</label>
                                <input type="text" id="openai_token" name="openai_token" class="form-control" value="<?php echo $wo['config']['openai_token']?>">
                                <small class="admin-info">OpenAI API key</small>
                            </div>
                        </div>
                        <label class="form-check-label" for="openai_text_model">OpenAI text model</label>
                        <select class="form-control show-tick" id="openai_text_model" name="openai_text_model">
                              <option value="gpt-4" <?php echo ($wo['config']['openai_text_model'] == 'gpt-4')   ? ' selected': '';?>>gpt-4</option>
                              <option value="gpt-4-0314" <?php echo ($wo['config']['openai_text_model'] == 'gpt-4-0314')   ? ' selected': '';?>>gpt-4-0314</option>
                              <option value="gpt-4-32k" <?php echo ($wo['config']['openai_text_model'] == 'gpt-4-32k')   ? ' selected': '';?>>gpt-4-32k</option>
                              <option value="gpt-4-32k-0314" <?php echo ($wo['config']['openai_text_model'] == 'gpt-4-32k-0314')   ? ' selected': '';?>>gpt-4-32k-0314</option>
                              <option value="gpt-3.5-turbo" <?php echo ($wo['config']['openai_text_model'] == 'gpt-3.5-turbo')   ? ' selected': '';?>>gpt-3.5-turbo</option>
                              <option value="gpt-3.5-turbo-0301" <?php echo ($wo['config']['openai_text_model'] == 'gpt-3.5-turbo-0301')   ? ' selected': '';?>>gpt-3.5-turbo-0301</option>
                        </select>
                        <input type="hidden" name="hash_id" value="<?php echo Wo_CreateSession();?>">
                    </form>
                </div>
            </div>
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">AI Settings</h6>
                    <form class="email-settings" method="POST">
                        <div class="float-left">
                            <label for="ai_image_system" class="main-label">AI Images System</label>
                            <div class="dropdown user_filter_drop">
                                <button class="btn btn-light" data-toggle="dropdown">
                                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M8 13C6.14 13 4.59 14.28 4.14 16H2V18H4.14C4.59 19.72 6.14 21 8 21S11.41 19.72 11.86 18H22V16H11.86C11.41 14.28 9.86 13 8 13M8 19C6.9 19 6 18.1 6 17C6 15.9 6.9 15 8 15S10 15.9 10 17C10 18.1 9.1 19 8 19M19.86 6C19.41 4.28 17.86 3 16 3S12.59 4.28 12.14 6H2V8H12.14C12.59 9.72 14.14 11 16 11S19.41 9.72 19.86 8H22V6H19.86M16 9C14.9 9 14 8.1 14 7C14 5.9 14.9 5 16 5S18 5.9 18 7C18 8.1 17.1 9 16 9Z"></path></svg>
                                </button>
                                <ul class="dropdown-menu">
                                    <div class="dropdown-menu-innr">
                                        <b>Who can use this feature?</b>
                                        <div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_image_use" id="ai_image_use-admin" onchange="SelectProModel('can_use_ai_image',this)" value="admin" <?php echo ($wo['config']['ai_image_use'] == 'admin')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_image_use-admin" data-toggle="tooltip" data-placement="bottom" title="Admin"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12,1L3,5V11C3,16.55 6.84,21.74 12,23C17.16,21.74 21,16.55 21,11V5L12,1M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M17.13,17C15.92,18.85 14.11,20.24 12,20.92C9.89,20.24 8.08,18.85 6.87,17C6.53,16.5 6.24,16 6,15.47C6,13.82 8.71,12.47 12,12.47C15.29,12.47 18,13.79 18,15.47C17.76,16 17.47,16.5 17.13,17Z"></path></svg></label> 
                                            </div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_image_use" id="ai_image_use-all" onchange="SelectProModel('can_use_ai_image',this)" value="all" <?php echo ($wo['config']['ai_image_use'] == 'all')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_image_use-all" data-toggle="tooltip" data-placement="bottom" title="All Users"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M16 17V19H2V17S2 13 9 13 16 17 16 17M12.5 7.5A3.5 3.5 0 1 0 9 11A3.5 3.5 0 0 0 12.5 7.5M15.94 13A5.32 5.32 0 0 1 18 17V19H22V17S22 13.37 15.94 13M15 4A3.39 3.39 0 0 0 13.07 4.59A5 5 0 0 1 13.07 10.41A3.39 3.39 0 0 0 15 11A3.5 3.5 0 0 0 15 4Z"></path></svg></label> 
                                            </div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_image_use" id="ai_image_use-verified" onchange="SelectProModel('can_use_ai_image',this)" value="verified" <?php echo ($wo['config']['ai_image_use'] == 'verified')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_image_use-verified" data-toggle="tooltip" data-placement="bottom" title="Verified Users Only"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M21.1,12.5L22.5,13.91L15.97,20.5L12.5,17L13.9,15.59L15.97,17.67L21.1,12.5M10,17L13,20H3V18C3,15.79 6.58,14 11,14L12.89,14.11L10,17M11,4A4,4 0 0,1 15,8A4,4 0 0,1 11,12A4,4 0 0,1 7,8A4,4 0 0,1 11,4Z"></path></svg></label> 
                                            </div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_image_use" id="ai_image_use-pro" onchange="SelectProModel('can_use_ai_image',this)" value="pro" <?php echo ($wo['config']['ai_image_use'] == 'pro')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_image_use-pro" data-toggle="tooltip" data-placement="bottom" title="Pro Users Only"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M15,14C12.33,14 7,15.33 7,18V20H23V18C23,15.33 17.67,14 15,14M15,12A4,4 0 0,0 19,8A4,4 0 0,0 15,4A4,4 0 0,0 11,8A4,4 0 0,0 15,12M5,13.28L7.45,14.77L6.8,11.96L9,10.08L6.11,9.83L5,7.19L3.87,9.83L1,10.08L3.18,11.96L2.5,14.77L5,13.28Z"></path></svg></label> 
                                            </div>
                                        </div>
                                    </div>
                                </ul>
                            </div>
                            <br><small class="admin-info">Allow AI to generate images.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="ai_image_system" value="0" />
                            <input type="checkbox" name="ai_image_system" id="chck-ai_image_system" value="1" <?php echo ($wo['config']['ai_image_system'] == 1) ? 'checked': '';?> <?php echo(EnableForMode('ai_image_system')) ?>>
                            <label for="chck-ai_image_system" class="check-trail <?php echo(EnableForMode('ai_image_system',true)) ?>" <?php echo(EnableForMode('ai_image_system',false,true)) ?>><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <label class="form-check-label" for="images_ai">AI Images API</label>
                        <select class="form-control show-tick" id="images_ai" name="images_ai">
                              <option value="openai"    <?php echo ($wo['config']['images_ai'] == 'openai')   ? ' selected': '';?>>OpenAI</option>
                              <option value="midjeourny"    <?php echo ($wo['config']['images_ai'] == 'midjeourny')   ? ' selected': '';?>>Replicate</option>
                        </select>
                        <div class="clearfix"></div>
                        <hr>
                        
                        <div class="float-left">
                            <label for="ai_post_system" class="main-label">AI Post System</label>
                            <div class="dropdown user_filter_drop">
                                <button class="btn btn-light" data-toggle="dropdown">
                                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M8 13C6.14 13 4.59 14.28 4.14 16H2V18H4.14C4.59 19.72 6.14 21 8 21S11.41 19.72 11.86 18H22V16H11.86C11.41 14.28 9.86 13 8 13M8 19C6.9 19 6 18.1 6 17C6 15.9 6.9 15 8 15S10 15.9 10 17C10 18.1 9.1 19 8 19M19.86 6C19.41 4.28 17.86 3 16 3S12.59 4.28 12.14 6H2V8H12.14C12.59 9.72 14.14 11 16 11S19.41 9.72 19.86 8H22V6H19.86M16 9C14.9 9 14 8.1 14 7C14 5.9 14.9 5 16 5S18 5.9 18 7C18 8.1 17.1 9 16 9Z"></path></svg>
                                </button>
                                <ul class="dropdown-menu">
                                    <div class="dropdown-menu-innr">
                                        <b>Who can use this feature?</b>
                                        <div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_post_use" id="ai_post_use-admin" onchange="SelectProModel('can_use_ai_post',this)" value="admin" <?php echo ($wo['config']['ai_post_use'] == 'admin')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_post_use-admin" data-toggle="tooltip" data-placement="bottom" title="Admin"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12,1L3,5V11C3,16.55 6.84,21.74 12,23C17.16,21.74 21,16.55 21,11V5L12,1M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M17.13,17C15.92,18.85 14.11,20.24 12,20.92C9.89,20.24 8.08,18.85 6.87,17C6.53,16.5 6.24,16 6,15.47C6,13.82 8.71,12.47 12,12.47C15.29,12.47 18,13.79 18,15.47C17.76,16 17.47,16.5 17.13,17Z"></path></svg></label> 
                                            </div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_post_use" id="ai_post_use-all" onchange="SelectProModel('can_use_ai_post',this)" value="all" <?php echo ($wo['config']['ai_post_use'] == 'all')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_post_use-all" data-toggle="tooltip" data-placement="bottom" title="All Users"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M16 17V19H2V17S2 13 9 13 16 17 16 17M12.5 7.5A3.5 3.5 0 1 0 9 11A3.5 3.5 0 0 0 12.5 7.5M15.94 13A5.32 5.32 0 0 1 18 17V19H22V17S22 13.37 15.94 13M15 4A3.39 3.39 0 0 0 13.07 4.59A5 5 0 0 1 13.07 10.41A3.39 3.39 0 0 0 15 11A3.5 3.5 0 0 0 15 4Z"></path></svg></label> 
                                            </div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_post_use" id="ai_post_use-verified" onchange="SelectProModel('can_use_ai_post',this)" value="verified" <?php echo ($wo['config']['ai_post_use'] == 'verified')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_post_use-verified" data-toggle="tooltip" data-placement="bottom" title="Verified Users Only"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M21.1,12.5L22.5,13.91L15.97,20.5L12.5,17L13.9,15.59L15.97,17.67L21.1,12.5M10,17L13,20H3V18C3,15.79 6.58,14 11,14L12.89,14.11L10,17M11,4A4,4 0 0,1 15,8A4,4 0 0,1 11,12A4,4 0 0,1 7,8A4,4 0 0,1 11,4Z"></path></svg></label> 
                                            </div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_post_use" id="ai_post_use-pro" onchange="SelectProModel('can_use_ai_post',this)" value="pro" <?php echo ($wo['config']['ai_post_use'] == 'pro')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_post_use-pro" data-toggle="tooltip" data-placement="bottom" title="Pro Users Only"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M15,14C12.33,14 7,15.33 7,18V20H23V18C23,15.33 17.67,14 15,14M15,12A4,4 0 0,0 19,8A4,4 0 0,0 15,4A4,4 0 0,0 11,8A4,4 0 0,0 15,12M5,13.28L7.45,14.77L6.8,11.96L9,10.08L6.11,9.83L5,7.19L3.87,9.83L1,10.08L3.18,11.96L2.5,14.77L5,13.28Z"></path></svg></label> 
                                            </div>
                                        </div>
                                    </div>
                                </ul>
                            </div>
                            <br><small class="admin-info">Allow AI to generate posts.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="ai_post_system" value="0" />
                            <input type="checkbox" name="ai_post_system" id="chck-ai_post_system" value="1" <?php echo ($wo['config']['ai_post_system'] == 1) ? 'checked': '';?> <?php echo(EnableForMode('ai_post_system')) ?>>
                            <label for="chck-ai_post_system" class="check-trail <?php echo(EnableForMode('ai_post_system',true)) ?>" <?php echo(EnableForMode('ai_post_system',false,true)) ?>><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <label class="form-check-label" for="post_ai">AI Posts API</label>
                        <select class="form-control show-tick" id="post_ai" name="post_ai">
                              <option value="openai"    <?php echo ($wo['config']['post_ai'] == 'openai')   ? ' selected': '';?>>OpenAI</option>
                              <option value="openai" disabled>Replicate (this feature is not supported by Replicate)</option>
                        </select>
                        <div class="clearfix"></div>
                        <hr>
                        
                        <div class="float-left">
                            <label for="ai_blog_system" class="main-label">AI Blog System</label>
                            <div class="dropdown user_filter_drop">
                                <button class="btn btn-light" data-toggle="dropdown">
                                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M8 13C6.14 13 4.59 14.28 4.14 16H2V18H4.14C4.59 19.72 6.14 21 8 21S11.41 19.72 11.86 18H22V16H11.86C11.41 14.28 9.86 13 8 13M8 19C6.9 19 6 18.1 6 17C6 15.9 6.9 15 8 15S10 15.9 10 17C10 18.1 9.1 19 8 19M19.86 6C19.41 4.28 17.86 3 16 3S12.59 4.28 12.14 6H2V8H12.14C12.59 9.72 14.14 11 16 11S19.41 9.72 19.86 8H22V6H19.86M16 9C14.9 9 14 8.1 14 7C14 5.9 14.9 5 16 5S18 5.9 18 7C18 8.1 17.1 9 16 9Z"></path></svg>
                                </button>
                                <ul class="dropdown-menu">
                                    <div class="dropdown-menu-innr">
                                        <b>Who can use this feature?</b>
                                        <div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_blog_use" id="ai_blog_use-admin" onchange="SelectProModel('can_use_ai_blog',this)" value="admin" <?php echo ($wo['config']['ai_blog_use'] == 'admin')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_blog_use-admin" data-toggle="tooltip" data-placement="bottom" title="Admin"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12,1L3,5V11C3,16.55 6.84,21.74 12,23C17.16,21.74 21,16.55 21,11V5L12,1M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M17.13,17C15.92,18.85 14.11,20.24 12,20.92C9.89,20.24 8.08,18.85 6.87,17C6.53,16.5 6.24,16 6,15.47C6,13.82 8.71,12.47 12,12.47C15.29,12.47 18,13.79 18,15.47C17.76,16 17.47,16.5 17.13,17Z"></path></svg></label> 
                                            </div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_blog_use" id="ai_blog_use-all" onchange="SelectProModel('can_use_ai_blog',this)" value="all" <?php echo ($wo['config']['ai_blog_use'] == 'all')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_blog_use-all" data-toggle="tooltip" data-placement="bottom" title="All Users"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M16 17V19H2V17S2 13 9 13 16 17 16 17M12.5 7.5A3.5 3.5 0 1 0 9 11A3.5 3.5 0 0 0 12.5 7.5M15.94 13A5.32 5.32 0 0 1 18 17V19H22V17S22 13.37 15.94 13M15 4A3.39 3.39 0 0 0 13.07 4.59A5 5 0 0 1 13.07 10.41A3.39 3.39 0 0 0 15 11A3.5 3.5 0 0 0 15 4Z"></path></svg></label> 
                                            </div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_blog_use" id="ai_blog_use-verified" onchange="SelectProModel('can_use_ai_blog',this)" value="verified" <?php echo ($wo['config']['ai_blog_use'] == 'verified')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_blog_use-verified" data-toggle="tooltip" data-placement="bottom" title="Verified Users Only"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M21.1,12.5L22.5,13.91L15.97,20.5L12.5,17L13.9,15.59L15.97,17.67L21.1,12.5M10,17L13,20H3V18C3,15.79 6.58,14 11,14L12.89,14.11L10,17M11,4A4,4 0 0,1 15,8A4,4 0 0,1 11,12A4,4 0 0,1 7,8A4,4 0 0,1 11,4Z"></path></svg></label> 
                                            </div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_blog_use" id="ai_blog_use-pro" onchange="SelectProModel('can_use_ai_blog',this)" value="pro" <?php echo ($wo['config']['ai_blog_use'] == 'pro')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_blog_use-pro" data-toggle="tooltip" data-placement="bottom" title="Pro Users Only"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M15,14C12.33,14 7,15.33 7,18V20H23V18C23,15.33 17.67,14 15,14M15,12A4,4 0 0,0 19,8A4,4 0 0,0 15,4A4,4 0 0,0 11,8A4,4 0 0,0 15,12M5,13.28L7.45,14.77L6.8,11.96L9,10.08L6.11,9.83L5,7.19L3.87,9.83L1,10.08L3.18,11.96L2.5,14.77L5,13.28Z"></path></svg></label> 
                                            </div>
                                        </div>
                                    </div>
                                </ul>
                            </div>
                            <br><small class="admin-info">Allow AI to generate articles.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="ai_blog_system" value="0" />
                            <input type="checkbox" name="ai_blog_system" id="chck-ai_blog_system" value="1" <?php echo ($wo['config']['ai_blog_system'] == 1) ? 'checked': '';?> <?php echo(EnableForMode('ai_blog_system')) ?>>
                            <label for="chck-ai_blog_system" class="check-trail <?php echo(EnableForMode('ai_blog_system',true)) ?>" <?php echo(EnableForMode('ai_blog_system',false,true)) ?>><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <label class="form-check-label" for="blog_ai">AI Blog API</label>
                        <select class="form-control show-tick" id="blog_ai" name="blog_ai">
                              <option value="openai"    <?php echo ($wo['config']['blog_ai'] == 'openai')   ? ' selected': '';?>>OpenAI</option>
                              <option value="openai" disabled>Replicate (this feature is not supported by Replicate)</option>
                        </select>
                        <div class="clearfix"></div>
                        <hr>
                        
                        <div class="float-left">
                            <label for="ai_user_system" class="main-label">AI Avatar/Cover System</label>
                            <div class="dropdown user_filter_drop">
                                <button class="btn btn-light" data-toggle="dropdown">
                                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M8 13C6.14 13 4.59 14.28 4.14 16H2V18H4.14C4.59 19.72 6.14 21 8 21S11.41 19.72 11.86 18H22V16H11.86C11.41 14.28 9.86 13 8 13M8 19C6.9 19 6 18.1 6 17C6 15.9 6.9 15 8 15S10 15.9 10 17C10 18.1 9.1 19 8 19M19.86 6C19.41 4.28 17.86 3 16 3S12.59 4.28 12.14 6H2V8H12.14C12.59 9.72 14.14 11 16 11S19.41 9.72 19.86 8H22V6H19.86M16 9C14.9 9 14 8.1 14 7C14 5.9 14.9 5 16 5S18 5.9 18 7C18 8.1 17.1 9 16 9Z"></path></svg>
                                </button>
                                <ul class="dropdown-menu">
                                    <div class="dropdown-menu-innr">
                                        <b>Who can use this feature?</b>
                                        <div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_user_use" id="ai_user_use-admin" onchange="SelectProModel('can_use_ai_user',this)" value="admin" <?php echo ($wo['config']['ai_user_use'] == 'admin')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_user_use-admin" data-toggle="tooltip" data-placement="bottom" title="Admin"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12,1L3,5V11C3,16.55 6.84,21.74 12,23C17.16,21.74 21,16.55 21,11V5L12,1M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M17.13,17C15.92,18.85 14.11,20.24 12,20.92C9.89,20.24 8.08,18.85 6.87,17C6.53,16.5 6.24,16 6,15.47C6,13.82 8.71,12.47 12,12.47C15.29,12.47 18,13.79 18,15.47C17.76,16 17.47,16.5 17.13,17Z"></path></svg></label> 
                                            </div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_user_use" id="ai_user_use-all" onchange="SelectProModel('can_use_ai_user',this)" value="all" <?php echo ($wo['config']['ai_user_use'] == 'all')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_user_use-all" data-toggle="tooltip" data-placement="bottom" title="All Users"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M16 17V19H2V17S2 13 9 13 16 17 16 17M12.5 7.5A3.5 3.5 0 1 0 9 11A3.5 3.5 0 0 0 12.5 7.5M15.94 13A5.32 5.32 0 0 1 18 17V19H22V17S22 13.37 15.94 13M15 4A3.39 3.39 0 0 0 13.07 4.59A5 5 0 0 1 13.07 10.41A3.39 3.39 0 0 0 15 11A3.5 3.5 0 0 0 15 4Z"></path></svg></label> 
                                            </div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_user_use" id="ai_user_use-verified" onchange="SelectProModel('can_use_ai_user',this)" value="verified" <?php echo ($wo['config']['ai_user_use'] == 'verified')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_user_use-verified" data-toggle="tooltip" data-placement="bottom" title="Verified Users Only"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M21.1,12.5L22.5,13.91L15.97,20.5L12.5,17L13.9,15.59L15.97,17.67L21.1,12.5M10,17L13,20H3V18C3,15.79 6.58,14 11,14L12.89,14.11L10,17M11,4A4,4 0 0,1 15,8A4,4 0 0,1 11,12A4,4 0 0,1 7,8A4,4 0 0,1 11,4Z"></path></svg></label> 
                                            </div>
                                            <div class="round_check">
                                                <input type="radio" name="ai_user_use" id="ai_user_use-pro" onchange="SelectProModel('can_use_ai_user',this)" value="pro" <?php echo ($wo['config']['ai_user_use'] == 'pro')   ? ' checked' : '';?>>
                                                <label class="radio-inline" for="ai_user_use-pro" data-toggle="tooltip" data-placement="bottom" title="Pro Users Only"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M15,14C12.33,14 7,15.33 7,18V20H23V18C23,15.33 17.67,14 15,14M15,12A4,4 0 0,0 19,8A4,4 0 0,0 15,4A4,4 0 0,0 11,8A4,4 0 0,0 15,12M5,13.28L7.45,14.77L6.8,11.96L9,10.08L6.11,9.83L5,7.19L3.87,9.83L1,10.08L3.18,11.96L2.5,14.77L5,13.28Z"></path></svg></label> 
                                            </div>
                                        </div>
                                    </div>
                                </ul>
                            </div>
                            <br><small class="admin-info">Allow users to edit Avatar/Cover using AI.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="ai_user_system" value="0" />
                            <input type="checkbox" name="ai_user_system" id="chck-ai_user_system" value="1" <?php echo ($wo['config']['ai_user_system'] == 1) ? 'checked': '';?> <?php echo(EnableForMode('ai_user_system')) ?>>
                            <label for="chck-ai_user_system" class="check-trail <?php echo(EnableForMode('ai_user_system',true)) ?>" <?php echo(EnableForMode('ai_user_system',false,true)) ?>><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <label class="form-check-label" for="user_ai">AI Avatar/Cover Images API</label>
                        <select class="form-control show-tick" id="user_ai" name="user_ai">
                              <option value="midjeourny" disabled>OpenAI (this feature is not supported by OpenAI)</option>
                              <option value="midjeourny"    <?php echo ($wo['config']['user_ai'] == 'midjeourny')   ? ' selected': '';?>>Replicate</option>
                        </select>
                        <div class="clearfix"></div>
                        <hr>
                        


                        
                        <input type="hidden" name="hash_id" value="<?php echo Wo_CreateSession();?>">
                    </form>
                </div>
            </div>
        </div>
        <div class="col-lg-6 col-md-6">
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">Replicate AI Settings</h6>
                    <form class="email-settings" method="POST">
                        <label class="form-check-label" for="midjeourny_model">Replicate Model</label>
                        <select class="form-control show-tick" id="midjeourny_model" name="midjeourny_model">
                              <option value="prompthero-openjourney" <?php echo ($wo['config']['midjeourny_model'] == 'prompthero-openjourney')   ? ' selected': '';?>>prompthero/openjourney</option>
                              <option value="stability-ai-stable-diffusion" <?php echo ($wo['config']['midjeourny_model'] == 'stability-ai-stable-diffusion')   ? ' selected': '';?>>stability-ai/stable-diffusion</option>
                              <option value="22-hours-vintedois-diffusion" <?php echo ($wo['config']['midjeourny_model'] == '22-hours-vintedois-diffusion')   ? ' selected': '';?>>22-hours/vintedois-diffusion</option>
                        </select>
                        <div class="clearfix"></div>
                        <hr>
                        
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Replicate API Token</label>
                                <input type="text" id="replicate_token" name="replicate_token" class="form-control" value="<?php echo $wo['config']['replicate_token']?>">
                                <small class="admin-info">Replicate API Token</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">num_inference_steps</label>
                                <input type="text" id="num_inference_steps" name="num_inference_steps" class="form-control" value="<?php echo $wo['config']['num_inference_steps']?>">
                                <small class="admin-info">Number of denoising steps (minimum: 1; maximum: 500)</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">guidance_scale</label>
                                <input type="text" id="guidance_scale" name="guidance_scale" class="form-control" value="<?php echo $wo['config']['guidance_scale']?>">
                                <small class="admin-info">Scale for classifier-free guidance (minimum: 1; maximum: 20)</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">seed</label>
                                <input type="text" id="seed" name="seed" class="form-control" value="<?php echo $wo['config']['seed']?>">
                                <small class="admin-info">Random seed. Leave blank to randomize the seed</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <?php if ($wo['config']['midjeourny_model'] != 'prompthero-openjourney') { ?>
                        <label class="form-check-label" for="scheduler">scheduler</label>
                        <select class="form-control show-tick" id="scheduler" name="scheduler">
                              <option value="DDIM" <?php echo ($wo['config']['scheduler'] == 'DDIM')   ? ' selected': '';?>>DDIM</option>
                              <option value="K_EULER" <?php echo ($wo['config']['scheduler'] == 'K_EULER')   ? ' selected': '';?>>K_EULER</option>
                              <option value="DPMSolverMultistep" <?php echo ($wo['config']['scheduler'] == 'DPMSolverMultistep')   ? ' selected': '';?>>DPMSolverMultistep</option>
                              <option value="K_EULER_ANCESTRAL" <?php echo ($wo['config']['scheduler'] == 'K_EULER_ANCESTRAL')   ? ' selected': '';?>>K_EULER_ANCESTRAL</option>
                              <option value="PNDM" <?php echo ($wo['config']['scheduler'] == 'PNDM')   ? ' selected': '';?>>PNDM</option>
                              <option value="KLMS" <?php echo ($wo['config']['scheduler'] == 'KLMS')   ? ' selected': '';?>>KLMS</option>
                        </select>
                        <div class="clearfix"></div>
                        <hr>
                        <?php } ?>
                        <?php if ($wo['config']['midjeourny_model'] == '22-hours-vintedois-diffusion') { ?>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">prompt_strength</label>
                                <input type="text" id="prompt_strength" name="prompt_strength" class="form-control" value="<?php echo $wo['config']['prompt_strength']?>">
                                <small class="admin-info">Prompt strength when using init image. 1.0 corresponds to full destruction of information in init image</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <?php } ?>
                        <?php if ($wo['config']['midjeourny_model'] != 'prompthero-openjourney') { ?>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">negative_prompt</label>
                                <input type="text" id="negative_prompt" name="negative_prompt" class="form-control" value="<?php echo $wo['config']['negative_prompt']?>">
                                <small class="admin-info">Specify things to not see in the output</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <?php } ?>
                        <input type="hidden" name="hash_id" value="<?php echo Wo_CreateSession();?>">
                    </form>
                </div>
            </div>
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">AI Credit Settings</h6>
                    <form class="email-settings" method="POST">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Credit Price</label>
                                <input type="text" id="credit_price" name="credit_price" class="form-control" value="<?php echo $wo['config']['credit_price']?>">
                                <small class="admin-info">Credit Price Ex: <?php echo Wo_GetCurrency($wo['config']['ads_currency']); ?>1 = 10 credits</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="float-left">
                            <label for="images_credit_system" class="main-label">AI Images Credit System</label>
                            <br><small class="admin-info">AI Images Credit System.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="images_credit_system" value="0" />
                            <input type="checkbox" name="images_credit_system" id="chck-images_credit_system" value="1" <?php echo ($wo['config']['images_credit_system'] == 1) ? 'checked': '';?> <?php echo(EnableForMode('images_credit_system')) ?>>
                            <label for="chck-images_credit_system" class="check-trail <?php echo(EnableForMode('images_credit_system',true)) ?>" <?php echo(EnableForMode('images_credit_system',false,true)) ?>><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Generated Image Price</label>
                                <input type="text" id="generated_image_price" name="generated_image_price" class="form-control" value="<?php echo $wo['config']['generated_image_price']?>">
                                <small class="admin-info">Generated Image Price</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="float-left">
                            <label for="text_credit_system" class="main-label">AI Text Credit System</label>
                            <br><small class="admin-info">AI Text Credit System.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="text_credit_system" value="0" />
                            <input type="checkbox" name="text_credit_system" id="chck-text_credit_system" value="1" <?php echo ($wo['config']['text_credit_system'] == 1) ? 'checked': '';?> <?php echo(EnableForMode('text_credit_system')) ?>>
                            <label for="chck-text_credit_system" class="check-trail <?php echo(EnableForMode('text_credit_system',true)) ?>" <?php echo(EnableForMode('text_credit_system',false,true)) ?>><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Generated Word Price</label>
                                <input type="text" id="generated_word_price" name="generated_word_price" class="form-control" value="<?php echo $wo['config']['generated_word_price']?>">
                                <small class="admin-info">Generated Word Price</small>
                            </div>
                        </div>
                        <input type="hidden" name="hash_id" value="<?php echo Wo_CreateSession();?>">
                    </form>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
    <!-- #END# Vertical Layout -->
<script>
$(function() {
    $('.round_check input[type=radio]').on('change', function() {
        clearTimeout(setTimeOutColor);
        var thisElement = $(this);
        var configName = thisElement.attr('name');
        var hash_id = $('input[name=hash_id]').val();
        var objData = {};
        objData[configName] = this.value;
        objData['hash_id'] = hash_id;
        thisElement.addClass('warning');
        $.post( Wo_Ajax_Requests_File() + '?f=admin_setting&s=update_general_setting', objData, function (data) {
            if (data.status == 200) {
                thisElement.removeClass('warning');
                thisElement.addClass('success');
            } else {
                thisElement.addClass('error');
            }
            var setTimeOutColor = setTimeout(function () {
                thisElement.removeClass('success');
                thisElement.removeClass('warning');
                thisElement.removeClass('error');
            }, 2000);
        });
    });

    $('.switcher input[type=checkbox]').click(function () {
        setToTrue = 0;
        if ($(this).is(":checked") === true) {
            setToTrue = 1;
        }
        var configName = $(this).attr('name');
        var hash_id = $('input[name=hash_id]').val();
        var objData = {};
        if (configName == 'redis') { 
            setToTrue = 'N';
            if ($(this).is(":checked") === true) {
              setToTrue = 'Y';
            }
        }
        objData[configName] = setToTrue;
        objData['hash_id'] = hash_id;
        $.post( Wo_Ajax_Requests_File() + '?f=admin_setting&s=update_general_setting', objData);
    });

    var setTimeOutColor = setTimeout(function (){});
    $('select').on('change', function() {
         clearTimeout(setTimeOutColor);
        var thisElement = $(this);
        var configName = thisElement.attr('name');
        var hash_id = $('input[name=hash_id]').val();
        var objData = {};
        objData[configName] = this.value;
        objData['hash_id'] = hash_id;
        thisElement.addClass('warning');
        $.post( Wo_Ajax_Requests_File() + '?f=admin_setting&s=update_general_setting', objData, function (data) {
            if (data.status == 200) {
                if (configName == 'midjeourny_model') {
                    window.location.reload();
                }
                thisElement.removeClass('warning');
                thisElement.addClass('success');
            } else {
                thisElement.addClass('error');
            }
            var setTimeOutColor = setTimeout(function () {
                thisElement.removeClass('success');
                thisElement.removeClass('warning');
                thisElement.removeClass('error');
            }, 2000);
        });
    });
    $('input[type=text], input[type=number]').on('input', delay(function() {
            clearTimeout(setTimeOutColor);
            var thisElement = $(this);
            var configName = thisElement.attr('name');
            var hash_id = $('input[name=hash_id]').val();
            var objData = {};
            objData[configName] = this.value;
            objData['hash_id'] = hash_id;
            thisElement.addClass('warning');
            $.post( Wo_Ajax_Requests_File() + '?f=admin_setting&s=update_general_setting', objData, function (data) {
                if (data.status == 200) {
                    thisElement.removeClass('warning');
                    thisElement.addClass('success');
                } else {
                    thisElement.addClass('error');
                }
                var setTimeOutColor = setTimeout(function () {
                    thisElement.removeClass('success');
                    thisElement.removeClass('warning');
                    thisElement.removeClass('error');
                }, 2000);
                //thisElement.focus();
            });
    }, 500));
});
</script>