<div class="flex flex-column h-100 items-center overflow-auto" data-test-modal="update-flow">
    <header class="gh-publish-header">
        <button class="gh-btn-editor gh-publish-back-button" title="Close" type="button" {{on "click" @close}}>
            <span>{{svg-jar "arrow-left"}} Editor</span>
        </button>
        <div class="flex">
            {{#let @data.publishOptions.post as |post|}}
                {{#if (not (and post.isSent (not post.isPublished)))}}
                    <button class="gh-btn gh-btn-editor darkgrey gh-unpublish-trigger active" title="Close" type="button" {{on "click" @close}}>
                        <span>{{if post.isScheduled "Unschedule" "Unpublish"}}</span>
                    </button>
                {{/if}}
            {{/let}}
            <div class="settings-menu-toggle-spacer"></div>
        </div>
    </header>

    {{#let @data.publishOptions.post as |post|}}
        <div class="gh-publish-settings-container gh-update-flow fade-in">
            <div class="gh-publish-title" data-test-update-flow-title>
                {{#if (and post.isSent (not post.isPublished))}}
                    This {{post.displayName}} was
                    <span class="green">{{post.status}} by email</span>
                {{else}}
                    This {{post.displayName}} has been
                    <span class="green">{{post.status}}</span>
                {{/if}}
            </div>

            <div class="gh-publish-confirmation" data-test-update-flow-confirmation>
                <p>
                    Your
                    {{post.displayName}}

                    {{if post.isScheduled "will be" "was"}}

                    {{#if
                        (or post.hasBeenEmailed
                            post.willEmail
                        )
                    }}
                        {{#if post.emailOnly}}
                            sent to
                        {{else}}
                            published and sent to
                        {{/if}}

                        {{#if post.isScheduled}}
                            {{#let (members-count-fetcher query=(hash filter=post.fullRecipientFilter)) as |countFetcher|}}
                                <strong>{{gh-pluralize countFetcher.count "subscriber"}}</strong>
                                {{#if this.showNewsletterName}}of <strong>{{post.newsletter.name}}</strong>{{/if}}
                            {{/let}}
                        {{else}}
                            <strong>{{gh-pluralize post.email.emailCount "subscriber"}}</strong>
                            {{#if this.showNewsletterName}}of <strong>{{post.newsletter.name}}</strong>{{/if}}
                        {{/if}}
                    {{else}}
                        published on your site
                    {{/if}}

                    {{#let (moment-site-tz post.publishedAtUTC) as |publishedAt|}}
                        on
                        {{moment-format publishedAt "D MMM YYYY"}}
                        at
                        {{moment-format publishedAt "HH:mm"}}.
                    {{/let}}

                    {{#if post.isScheduled}}
                        {{#if (and post.isScheduled post.email)}}
                            This post was previously emailed to

                            <strong>{{pluralize post.email.emailCount "subscriber"}}</strong>

                            {{#if this.showNewsletterName}}
                                of <strong>{{post.newsletter.name}}</strong>
                            {{/if}}

                            {{#let (moment-site-tz post.email.createdAtUTC) as |sentAt|}}
                                on
                                {{moment-format sentAt "D MMM YYYY"}}
                                at
                                {{moment-format sentAt "HH:mm"}}.
                            {{/let}}
                        {{/if}}

                        <br><br>
                        Need to make a change?
                        <button
                            type="button"
                            class="gh-revert-to-draft"
                            {{on "click" (fn @close (hash afterTask="revertToDraftTask"))}}
                            data-test-button="revert-to-draft"
                        >
                            <span>Unschedule and revert to draft &rarr;</span>
                        </button>
                    {{else if (not post.emailOnly)}}
                        <br><br>
                        <button
                            type="button"
                            class="gh-revert-to-draft"
                            {{on "click" (fn @close (hash afterTask="revertToDraftTask"))}}
                            data-test-button="revert-to-draft"
                        >
                            <span>Unpublish and revert to private draft &rarr;</span>
                        </button>
                    {{/if}}
                </p>
            </div>
        </div>
    {{/let}}
</div>
