<div class="settings__content">
    <h1><i class="fa fa-cog"></i> {{res 'setGenTitle'}}</h1>

    {{#if updateWaitingReload}}
    <h2 class="action-color">{{res 'setGenUpdate'}}</h2>
    <div>{{res 'setGenNewVersion'}}. <a href="{{releaseNotesLink}}" target="_blank">{{res 'setGenReleaseNotes'}}</a></div>
    <div class="settings__general-update-buttons">
        <button class="settings__general-restart-btn">{{res 'setGenReloadToUpdate'}}</button>
    </div>
    {{else if updateManual}}
    <h2 class="action-color">{{res 'setGenUpdate'}}</h2>
    <div>{{res 'setGenUpdateManual'}}</div>
    <div class="settings__general-update-buttons">
        <button class="settings__general-download-update-btn">{{res 'setGenDownloadUpdate'}}</button>
    </div>
    {{/if}}
    {{#if showUpdateBlock}}
    <h2>{{res 'setGenUpdate'}}</h2>
    <div>
        <select class="settings__general-auto-update settings__select input-base">
            <option value="install" {{#ifeq autoUpdate 'install'}}selected{{/ifeq}}>{{res 'setGenUpdateAuto'}}</option>
            <option value="check" {{#ifeq autoUpdate 'check'}}selected{{/ifeq}}>{{res 'setGenUpdateCheck'}}</option>
            <option value="" {{#unless autoUpdate}}selected{{/unless}}>{{res 'setGenNoUpdate'}}</option>
        </select>
        <div>{{updateInfo}}</div>
        <a href="{{releaseNotesLink}}" target="_blank">{{res 'setGenReleaseNotes'}}</a>
    </div>
    <div class="settings__general-update-buttons">
        {{#if updateInProgress}}
        <button class="settings__general-update-btn btn-silent" disabled>{{res 'setGenUpdateChecking'}}</button>
        {{else}}
        <button class="settings__general-update-btn btn-silent">{{res 'setGenCheckUpdate'}}</button>
        {{/if}}
        {{#if updateReady}}<button class="settings__general-restart-btn">{{res 'setGenRestartToUpdate'}}</button>{{/if}}
        {{#if updateFound}}<button class="settings__general-update-found-btn">{{res 'setGenDownloadAndRestart'}}</button>{{/if}}
    </div>
    {{/if}}

    <h2>{{res 'setGenAppearance'}}</h2>
    {{#if locales}}
    <div>
        <label for="settings__general-locale">{{res 'setGenLocale'}}:</label>
        <select class="settings__general-locale settings__select input-base" id="settings__general-locale">
            {{#each locales as |name key|}}
                <option value="{{key}}" {{#ifeq key ../activeLocale}}selected{{/ifeq}}>{{name}}</option>
            {{/each}}
            <option value="...">({{res 'setGenLocOther'}})</option>
        </select>
    </div>
    {{/if}}
    <div>
        <label for="settings__general-theme">{{res 'setGenTheme'}}:</label>
        <select class="settings__general-theme settings__select input-base" id="settings__general-theme">
            {{#each themes as |name key|}}
            <option value="{{key}}" {{#ifeq key ../activeTheme}}selected{{/ifeq}}>{{name}}</option>
            {{/each}}
        </select>
    </div>
    <div>
        <label for="settings__general-font-size">{{res 'setGenFontSize'}}:</label>
        <select class="settings__general-font-size settings__select input-base" id="settings__general-font-size">
            <option value="0" {{#ifeq fontSize 0}}selected{{/ifeq}}>{{res 'setGenFontSizeNormal'}}</option>
            <option value="1" {{#ifeq fontSize 1}}selected{{/ifeq}}>{{res 'setGenFontSizeLarge'}}</option>
            <option value="2" {{#ifeq fontSize 2}}selected{{/ifeq}}>{{res 'setGenFontSizeLargest'}}</option>
        </select>
    </div>
    {{#if supportsTitleBarStyles}}
    <div>
      <label for="settings__general-titlebar-style">{{res 'setGenTitlebarStyle'}}:</label>
      <select class="settings__general-titlebar-style settings__select input-base" id="settings__general-titlebar-style">
        <option value="default" {{#ifeq titlebarStyle 'default'}}selected{{/ifeq}}>{{res 'setGenTitlebarStyleDefault'}}</option>
        <option value="hidden" {{#ifeq titlebarStyle 'hidden'}}selected{{/ifeq}}>{{res 'setGenTitlebarStyleHidden'}}</option>
        <option value="hidden-inset" {{#ifeq titlebarStyle 'hidden-inset'}}selected{{/ifeq}}>{{res 'setGenTitlebarStyleHiddenInset'}}</option>
      </select>
    </div>
    {{/if}}
    <div>
        <input type="checkbox" class="settings__input input-base settings__general-expand" id="settings__general-expand" {{#if expandGroups}}checked{{/if}} />
        <label for="settings__general-expand">{{res 'setGenShowSubgroups'}}</label>
    </div>
    {{#if canSetTableView}}
    <div>
        <input type="checkbox" class="settings__input input-base settings__general-table-view" id="settings__general-table-view" {{#if tableView}}checked{{/if}} />
        <label for="settings__general-table-view">{{res 'setGenTableView'}}</label>
    </div>
    {{/if}}
    <div>
        <input type="checkbox" class="settings__input input-base settings__general-colorful-icons" id="settings__general-colorful-icons" {{#if colorfulIcons}}checked{{/if}} />
        <label for="settings__general-colorful-icons">{{res 'setGenColorfulIcons'}}</label>
    </div>
    <div>
        <input type="checkbox" class="settings__input input-base settings__general-use-markdown" id="settings__general-use-markdown" {{#if useMarkdown}}checked{{/if}} />
        <label for="settings__general-use-markdown">{{res 'setGenUseMarkdown'}}</label>
    </div>

    <h2>{{res 'setGenFunction'}}</h2>
    {{#if canAutoSaveOnClose}}
    <div>
        <input type="checkbox" class="settings__input input-base settings__general-auto-save" id="settings__general-auto-save"
            {{#if autoSave}}checked{{/if}} />
        <label for="settings__general-auto-save">{{res 'setGenAutoSyncOnClose'}}</label>
    </div>
    {{/if}}
    <div>
        <label for="settings__general-auto-save-interval">{{res 'setGenAutoSyncTimer'}}</label>
        <select class="settings__select input-base settings__general-auto-save-interval"
                id="settings__general-auto-save-interval">
            <option value="0" {{#ifeq autoSaveInterval 0}}selected{{/ifeq}}>{{res 'setGenAutoSyncTimerOff'}}</option>
            <option value="1" {{#ifeq autoSaveInterval 1}}selected{{/ifeq}}>{{#res 'setGenAutoSyncTimerInterval'}}
                1{{/res}}</option>
            <option value="5" {{#ifeq autoSaveInterval 5}}selected{{/ifeq}}>{{#res 'setGenAutoSyncTimerInterval'}}
                5{{/res}}</option>
            <option value="15" {{#ifeq autoSaveInterval 15}}selected{{/ifeq}}>{{#res 'setGenAutoSyncTimerInterval'}}
                15{{/res}}</option>
            <option value="30" {{#ifeq autoSaveInterval 30}}selected{{/ifeq}}>{{#res 'setGenAutoSyncTimerInterval'}}
                30{{/res}}</option>
            <option value="60" {{#ifeq autoSaveInterval 60}}selected{{/ifeq}}>{{#res 'setGenAutoSyncTimerInterval'}}
                60{{/res}}</option>
        </select>
    </div>
    <div>
        <label for="settings__general-remember-key-files">{{res 'setGenRememberKeyFiles'}}:</label>
        <select class="settings__general-remember-key-files settings__select input-base" id="settings__general-remember-key-files">
            <option value="" {{#unless rememberKeyFiles}}selected{{/unless}}>{{res 'setGenNoRememberKeyFiles'}}</option>
            <option value="data" {{#ifeq rememberKeyFiles 'data'}}selected{{/ifeq}}>{{res 'setGenRememberKeyFilesData'}}</option>
            {{#if supportFiles}}<option value="path" {{#ifeq rememberKeyFiles 'path'}}selected{{/ifeq}}>{{res 'setGenRememberKeyFilesPath'}}</option>{{/if}}
        </select>
    </div>
    {{#if canClearClipboard}}
    <div>
        <label for="settings__general-clipboard">{{res 'setGenClearClip'}}:</label>
        <select class="settings__general-clipboard settings__select input-base" id="settings__general-clipboard">
            <option value="0" {{#unless clipboardSeconds}}selected{{/unless}}>{{res 'setGenNoClear'}}</option>
            <option value="5" {{#ifeq clipboardSeconds 5}}selected{{/ifeq}}>{{#res 'setGenClearSeconds'}}5{{/res}}</option>
            <option value="10" {{#ifeq clipboardSeconds 10}}selected{{/ifeq}}>{{#res 'setGenClearSeconds'}}10{{/res}}</option>
            <option value="15" {{#ifeq clipboardSeconds 15}}selected{{/ifeq}}>{{#res 'setGenClearSeconds'}}15{{/res}}</option>
            <option value="60" {{#ifeq clipboardSeconds 60}}selected{{/ifeq}}>{{res 'setGenClearMinute'}}</option>
        </select>
    </div>
    {{/if}}
    {{#if canMinimize}}
    <div>
        <input type="checkbox" class="settings__input input-base settings__general-minimize" id="settings__general-minimize"
            {{#if minimizeOnClose}}checked{{/if}} />
        <label for="settings__general-minimize">{{res 'setGenMinInstead'}}</label>
    </div>
    {{/if}}
    {{#if canAutoType}}
    <div>
        <input type="checkbox" class="settings__input input-base settings__general-direct-autotype"
            id="settings__general-direct-autotype" {{#if directAutotype}}checked{{/if}} />
        <label for="settings__general-direct-autotype">{{res 'setGenDirectAutotype'}}</label>
    </div>
    {{/if}}

    <h2>{{res 'setGenLock'}}</h2>
    <div>
        <label for="settings__general-idle-minutes">{{res 'setGenLockInactive'}}:</label>
        <select class="settings__general-idle-minutes settings__select input-base" id="settings__general-idle-minutes">
            <option value="0" {{#cmp idleMinutes 0 '<='}}selected{{/cmp}}>{{res 'setGenNoAutoLock'}}</option>
            <option value="5" {{#ifeq idleMinutes 5}}selected{{/ifeq}}>{{#res 'setGenLockMinutes'}}5{{/res}}</option>
            <option value="10" {{#ifeq idleMinutes 10}}selected{{/ifeq}}>{{#res 'setGenLockMinutes'}}10{{/res}}</option>
            <option value="15" {{#ifeq idleMinutes 15}}selected{{/ifeq}}>{{#res 'setGenLockMinutes'}}15{{/res}}</option>
            <option value="30" {{#ifeq idleMinutes 30}}selected{{/ifeq}}>{{#res 'setGenLockMinutes'}}30{{/res}}</option>
            <option value="60" {{#ifeq idleMinutes 60}}selected{{/ifeq}}>{{res 'setGenLockHour'}}</option>
            <option value="720" {{#ifeq idleMinutes 720}}selected{{/ifeq}}>{{#res 'setGenLockHours'}}12{{/res}}</option>
            <option value="1440" {{#ifeq idleMinutes 1440}}selected{{/ifeq}}>{{res 'setGenLockDay'}}</option>
        </select>
    </div>
    {{#if canDetectMinimize}}
    <div>
        <input type="checkbox" class="settings__input input-base settings__general-lock-on-minimize" id="settings__general-lock-on-minimize"
               {{#if lockOnMinimize}}checked{{/if}} />
        <label for="settings__general-lock-on-minimize">{{res 'setGenLockMinimize'}}</label>
    </div>
    {{/if}}
    <div>
        <input type="checkbox" class="settings__input input-base settings__general-lock-on-copy" id="settings__general-lock-on-copy"
               {{#if lockOnCopy}}checked{{/if}} />
        <label for="settings__general-lock-on-copy">{{res 'setGenLockCopy'}}</label>
    </div>
    {{#if canAutoType}}
    <div>
        <input type="checkbox" class="settings__input input-base settings__general-lock-on-auto-type" id="settings__general-lock-on-auto-type"
               {{#if lockOnAutoType}}checked{{/if}} />
        <label for="settings__general-lock-on-auto-type">{{res 'setGenLockAutoType'}}</label>
    </div>
    {{/if}}
    {{#if canDetectOsSleep}}
        <div>
            <input type="checkbox" class="settings__input input-base settings__general-lock-on-os-lock" id="settings__general-lock-on-os-lock"
                   {{#if lockOnOsLock}}checked{{/if}} />
            <label for="settings__general-lock-on-os-lock">{{res 'setGenLockOrSleep'}}</label>
        </div>
    {{/if}}
    <h2>{{res 'setGenStorage'}}</h2>
    {{#each storageProviders as |prv|}}
    <h4 class="settings__general-storage-header"><input
            type="checkbox" id="settings__general-prv-check-{{prv.name}}" class="settings__general-prv-check"
            data-storage="{{prv.name}}" {{#if prv.enabled}}checked{{/if}}
    /><label for="settings__general-prv-check-{{prv.name}}">{{res prv.name}}</label></h4>
    <div class="settings__general-prv-wrap settings__general-{{prv.name}} {{#ifeq prv.enabled false}}hide{{/ifeq}}"></div>
    {{/each}}

    <h2>{{res 'advanced'}}</h2>
    <a class="settings__general-show-advanced">{{res 'setGenShowAdvanced'}}</a>
    <div class="settings__general-advanced hide">
        {{#if devTools}}
            <button class="btn-silent settings__general-dev-tools-link">{{res 'setGenDevTools'}}</button>
            <button class="btn-silent settings__general-try-beta-link">{{res 'setGenTryBeta'}}</button>
        {{/if}}
        {{#if showReloadApp}}
            <button class="btn-silent settings__general-reload-app-link">{{res 'setGenReloadApp'}}</button>
        {{/if}}
        <button class="btn-silent settings__general-show-logs-link">{{res 'setGenShowAppLogs'}}</button>
    </div>
</div>
