<?php
    /**
     * The campaign as stored, with where each value came from.
     *
     * Rendered server side from the database rather than from the chat, so what
     * is shown and what would be published can never disagree.
     */
    $dot = fn (?string $source) => match ($source) {
        'user_stated' => ['bg-success', 'you said this'],
        'platform_returned' => ['bg-primary', 'returned by the platform'],
        'model_inferred' => ['bg-warning', 'worked out from context'],
        'fallback' => ['bg-danger', 'guessed, needs confirming'],
        default => ['bg-secondary-subtle', 'not set'],
    };

    $row = function (string $label, $value, ?string $source) use ($dot) {
        [$colour, $title] = $dot($source);

        return [$label, $value, $colour, $title];
    };

    /**
     * What this platform actually has, so the panel stops describing every
     * campaign as a Meta one.
     *
     * A Google campaign was shown a Facebook Page, an Instagram account and a
     * pixel, none of which it can ever hold, all reading "—" forever. An empty
     * row is not neutral: it reads as an unanswered question.
     *
     * Asked of the platform's own rules rather than listed here, so a platform
     * added later gets the right panel by declaring its rules and nothing else.
     */
    // Null for a conversation with no campaign yet, and for any caller that
    // renders this without saying which platform it is looking at, which shows
    // every row rather than silently hiding one.
    $rules ??= null;
    $platforms ??= null;

    /**
     * The platform's own word for a field, taken from its step list.
     *
     * Meta calls it a pixel and Google calls it a conversion action, and each
     * already says so in steps(). Reading the label from there means the panel
     * and the progress list can never drift apart, and neither needs its own
     * table of names.
     */
    $named = function (string $key, string $fallback) use ($rules): string {
        $label = collect($rules?->steps() ?? [])->firstWhere('key', $key)['label'] ?? $fallback;

        return ucfirst($label);
    };

    $has = function (string $field) use ($rules): bool {
        if (! $rules) {
            return true;
        }

        return match ($field) {
            'page' => $rules->requiresPage(),
            'placements' => $rules->placements() !== [],
            'instagram' => in_array('instagram', $rules->placements(), true),
            // No single objective decides it: the row is worth showing if this
            // platform has the concept at all.
            'pixel' => collect($rules->objectives())
                ->contains(fn (string $objective): bool => $rules->requiresPixel($objective)),
            // Asked of the flow, not of conversionEvent(), which LinkedIn also
            // answers: it maps objectives to events for its own publisher while
            // having no step to choose one and no tool that would accept it. A
            // row nothing can ever fill is the permanent grey dot this panel
            // already warns about above.
            'conversion_event' => collect($rules->steps())
                ->contains(fn (array $step): bool => ($step['key'] ?? null) === 'conversion_event'),
            default => true,
        };
    };

    $platformName = function ($key) use ($platforms): string {
        $platforms ??= app(\App\Campaigns\Platforms\Platforms::class);

        return $platforms->supports((string) $key)
            ? $platforms->for((string) $key)->name()
            : ucfirst((string) $key);
    };

    $selectedLocationRows = $campaign?->targetingSet?->locations()
        ->where('kind', '!=', 'country')
        ->orderBy('id')
        ->get(['country_code', 'display_label']) ?? collect();
    $selectedPlaces = $selectedLocationRows->pluck('display_label')->all();
    $narrowedCountries = in_array($campaign?->platform, ['meta', 'google'], true)
        ? $selectedLocationRows->pluck('country_code')->filter()->all()
        : [];
    $countryCodes = $campaign
        ? app(\App\Campaigns\Targeting\TargetingSelections::class)->countries($campaign)
        : [];
    $countrySummary = implode(', ', array_map(
        fn (string $code): string => in_array($code, $narrowedCountries, true)
            ? $code.' (selected places only)'
            : $code,
        $countryCodes,
    ));

    foreach (['cities' => 'city', 'regions' => 'region'] as $field => $kind) {
        foreach ((array) ($campaign?->locations['meta_geo_locations'][$field] ?? []) as $place) {
            if (filled($place['key'] ?? null)) {
                $selectedPlaces[] = 'Imported Meta '.$kind.' ID '.$place['key'];
            }
        }
    }

    foreach ((array) ($campaign?->locations['google_location_criteria'] ?? []) as $criterion) {
        if (strtolower((string) ($criterion['target_type'] ?? '')) === 'country' && ! ($criterion['negative'] ?? false)) {
            continue;
        }

        $selectedPlaces[] = sprintf(
            'Imported Google %s%s: %s',
            ($criterion['negative'] ?? false) ? 'excluded ' : '',
            strtolower((string) ($criterion['target_type'] ?? 'location')),
            (string) ($criterion['name'] ?: $criterion['geo_target'] ?? 'unknown'),
        );
    }
?>


<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(($campaigns ?? collect())->count() > 1): ?>
    <div class="mb-campaign-switch mb-campaign-nav-tabs" role="tablist" aria-label="Campaign Platforms">
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $campaigns; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $option): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <button type="button"
                    class="mb-campaign-tab mb-campaign-nav-tab<?php echo e($campaign && $option->id === $campaign->id ? ' active' : ''); ?>"
                    role="tab"
                    aria-selected="<?php echo e($campaign && $option->id === $campaign->id ? 'true' : 'false'); ?>"
                    data-focus-campaign="<?php echo e($option->id); ?>">
                <?php echo e($platformName($option->platform)); ?>

            </button>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
    </div>
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>


<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! empty($workingOn)): ?>
    <p class="mb-campaign-note mb-2">
        Looking at this one. Your next answer goes to <strong><?php echo e($workingOn); ?></strong>,
        unless you say otherwise.
    </p>
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! $campaign): ?>
    <p class="text-body-secondary small mb-0">No campaign yet. It appears here as the chat fills it in.</p>
<?php else: ?>
    <div class="d-flex justify-content-between align-items-start mb-2">
        <strong><?php echo e($campaign->name); ?></strong>
        <span class="badge <?php echo e($campaign->status === 'published' ? 'text-bg-success' : 'text-bg-secondary'); ?>">
            <?php echo e($campaign->status); ?>

        </span>
    </div>

    
    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! empty($progress)): ?>
        <?php
            $settled = collect($progress)->where('done', true)->count();
            $total = count($progress);
        ?>

        <div class="mb-progress">
            <div class="mb-progress-head">
                <span class="mb-progress-count"><?php echo e($settled); ?> of <?php echo e($total); ?></span>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($nextStep): ?>
                    <span class="mb-progress-next">Next: <?php echo e($nextStep['label']); ?></span>
                <?php else: ?>
                    <span class="mb-progress-next is-ready">Everything answered</span>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>

            <div class="mb-progress-track" role="progressbar"
                 aria-valuenow="<?php echo e($settled); ?>" aria-valuemin="0" aria-valuemax="<?php echo e($total); ?>"
                 aria-label="Campaign setup progress">
                <span class="mb-progress-fill" style="width: <?php echo e($total ? round($settled / $total * 100) : 0); ?>%"></span>
            </div>

            <ol class="mb-progress-steps">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $progress; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $step): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    
                    <li class="mb-progress-step<?php echo e($step['done'] ? ' is-done' : ''); ?><?php echo e($nextStep && $nextStep['key'] === $step['key'] ? ' is-next' : ''); ?>"
                        data-step-prompt="<?php echo e(($step['done'] ? 'Review or change the ' : 'Help me configure the ') . $step['label'] . ' for ' . $campaign->name); ?>"
                        title="<?php echo e($step['done'] ? 'Completed: ' . $step['label'] . ' (click to change)' : 'Click to prompt AI for ' . $step['label']); ?>">
                        <i class="bi <?php echo e($step['done'] ? 'bi-check-circle-fill' : 'bi-circle'); ?>"></i>
                        <?php echo e($step['label']); ?>

                    </li>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </ol>
        </div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    <table class="table table-sm mb-3">
        <tbody>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = array_values(array_filter([
                $row('Platform', $campaign->platform, $sources['platform'] ?? null),
                $row('Objective', $campaign->objective, $sources['objective'] ?? null),
                $row('Landing page', $campaign->landing_url, $sources['landing_url'] ?? null),
                
                $row(
                    'Click tracking',
                    $campaign->utm === null ? null : ($campaign->utm === '' ? 'none' : $campaign->utm),
                    $sources['utm'] ?? null,
                ),
                
                $row(
                    $campaign->usesLifetimeBudget() ? 'Lifetime budget' : 'Daily budget',
                    $campaign->budget
                        ? $campaign->currency.' '.$campaign->budget
                            .($campaign->usesCampaignBudget() ? ', on the campaign' : ', on the ad set')
                        : null,
                    $sources['budget'] ?? null,
                ),
                $row('Bidding', $campaign->bid_strategy, $sources['bid_strategy'] ?? null),
                $row('Target cost', $campaign->bid_amount, $sources['bid_amount'] ?? null),
                $row('Countries', $countrySummary, $sources['locations'] ?? null),
                $selectedPlaces !== [] ? $row('Cities / regions', implode('; ', $selectedPlaces), $sources['locations'] ?? null) : null,
                
                $has('placements')
                    ? $row(
                        str_contains($named('targeting', 'placements'), 'networks') ? 'Networks' : 'Placements',
                        implode(', ', $campaign->placements ?? []),
                        $sources['placements'] ?? null,
                    )
                    : null,
                $row('Devices', implode(', ', $campaign->audience['devices'] ?? []) ?: null, $sources['audience'] ?? null),
                $row('Ad account', $campaign->ad_account_id, $sources['ad_account_id'] ?? null),
                $has('page') ? $row('Page', $campaign->page_id, $sources['page_id'] ?? null) : null,
                
                $has('instagram')
                    ? $row(
                        'Instagram',
                        $campaign->instagram_account_id === null
                            ? null
                            : ($campaign->instagram_account_id ?: 'runs under the Page'),
                        $sources['instagram_account_id'] ?? null,
                    )
                    : null,
                $has('pixel') ? $row($named('pixel', 'pixel'), $campaign->pixel_id, $sources['pixel_id'] ?? null) : null,
                // Shown as the pixel spells it rather than as the enum, because
                // "Subscribe" is what the buyer picked and what they will look
                // for in Events Manager. SUBSCRIBE is Meta's word for it.
                $has('conversion_event')
                    ? $row(
                        'optimises toward',
                        \App\Campaigns\Objectives::eventName($campaign->conversion_event) ?: $campaign->conversion_event,
                        $sources['conversion_event'] ?? null,
                    )
                    : null,
            ])); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as [$label, $value, $colour, $title]): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr class="mb-panel-row" data-row-prompt="I want to update the <?php echo e($label); ?> for <?php echo e($campaign->name); ?>." title="Click to ask AI about <?php echo e($label); ?>">
                    <td class="text-body-secondary" style="width: 38%;">
                        <span class="mb-dot <?php echo e($colour); ?>" title="<?php echo e($title); ?>"></span>
                        <?php echo e($label); ?>

                    </td>
                    <td class="text-break"><?php echo e(filled($value) ? $value : '—'); ?></td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </tbody>
    </table>

    
    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(! $rules || $rules->requiresCreativeAsset($campaign)): ?>
        <div class="small text-body-secondary mb-1">
            Creatives: <?php echo e($assets->count()); ?> attached
        </div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    
    
    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($campaign->ads()->exists()): ?>
        <div class="mb-preview-toggle-bar">
            <button type="button" class="mb-preview-toggle-btn active" data-ad-view="mockup">Live Ad Preview</button>
            <button type="button" class="mb-preview-toggle-btn" data-ad-view="list">Ad Variations (<?php echo e($campaign->ads->count()); ?>)</button>
        </div>

        <div id="adViewMockup" class="mb-ad-mockups mb-3">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $campaign->ads; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ad): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php ($asset = $ad->asset); ?>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($campaign->platform === 'google'): ?>
                    <div class="mb-ad-mockup-google">
                        <div>
                            <span class="mb-mockup-google-badge">Sponsored</span>
                            <span class="mb-mockup-google-url"><?php echo e(parse_url($campaign->landing_url ?? 'https://example.com', PHP_URL_HOST) ?? 'example.com'); ?></span>
                        </div>
                        <div class="mb-mockup-google-title"><?php echo e($ad->headline); ?></div>
                        <div class="mb-mockup-google-desc"><?php echo e($ad->primary_text); ?></div>
                    </div>
                <?php else: ?>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = ($previewIdentities ?? []) ?: [['platform' => $platformName($campaign->platform), 'name' => $campaign->name, 'icon' => $campaign->platform === 'linkedin' ? 'linkedin' : 'meta']]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $identity): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="mb-ad-mockup-meta">
                        <div class="mb-mockup-header">
                            <div class="mb-mockup-avatar">
                                <i class="bi bi-<?php echo e($identity['icon']); ?>" aria-label="<?php echo e($identity['platform']); ?>"></i>
                            </div>
                            <div class="mb-mockup-meta-info">
                                <div class="mb-mockup-page-name"><?php echo e($identity['name']); ?></div>
                                <div class="mb-mockup-sponsored"><?php echo e($identity['platform']); ?> &middot; Sponsored</div>
                            </div>
                        </div>
                        <div class="mb-mockup-body"><?php echo e($ad->primary_text); ?></div>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($asset && $asset->hasStill()): ?>
                            <div class="mb-mockup-media">
                                <img src="<?php echo e(route('assets.preview', $asset)); ?>" alt="">
                            </div>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        <div class="mb-mockup-footer">
                            <div class="mb-mockup-link-info">
                                <div class="mb-mockup-domain"><?php echo e(parse_url($campaign->landing_url ?? 'https://example.com', PHP_URL_HOST) ?? 'example.com'); ?></div>
                                <div class="mb-mockup-headline"><?php echo e($ad->headline); ?></div>
                            </div>
                            <span class="mb-mockup-cta-btn"><?php echo e(str_replace('_', ' ', $ad->cta ?? 'LEARN MORE')); ?></span>
                        </div>
                    </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>

        <div id="adViewList" class="small mb-3 d-none">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $campaign->ads; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ad): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php ($asset = $ad->asset); ?>
                <div class="border rounded p-2 mb-1 mb-ad">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($asset && $asset->hasStill()): ?>
                        <span class="mb-ad-thumb-wrap">
                            <img class="mb-ad-thumb" src="<?php echo e(route('assets.preview', $asset)); ?>" alt="">
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($asset->kind === 'video'): ?>
                                <i class="bi bi-play-btn mb-ad-thumb-play" title="Video creative"></i>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </span>
                    <?php else: ?>
                        <span class="mb-ad-thumb mb-ad-thumb-empty"
                              title="<?php echo e($asset ? 'Video creative' : 'No creative attached'); ?>">
                            <i class="bi bi-<?php echo e($asset ? ($asset->kind === 'video' ? 'play-btn' : 'image') : 'dash'); ?>"></i>
                        </span>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                    <div class="mb-ad-body">
                        <div class="fw-semibold"><?php echo e($ad->headline); ?></div>
                        <div class="text-body-secondary"><?php echo e($ad->primary_text); ?></div>
                        <span class="badge text-bg-light"><?php echo e($ad->cta); ?></span>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if (! ($asset)): ?>
                            <span class="badge text-bg-warning">no creative</span>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($pending || $needsRebuild): ?>
        <div class="alert alert-warning small py-2">
            <div class="fw-semibold mb-1">Not yet on the platform</div>

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $pending; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $field => $change): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div>
                    <?php echo e(str_replace('_', ' ', $field)); ?>:
                    <span class="text-decoration-line-through"><?php echo e($change['from'] ?? 'not set'); ?></span>
                    &rarr; <strong><?php echo e($change['to'] ?? 'not set'); ?></strong>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $needsRebuild; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $reason): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div><?php echo e($reason); ?></div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($pending): ?>
                <div class="mt-1">Ask in the chat to push these changes.</div>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    
    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($campaign->external_ids): ?>
        <div class="alert alert-success small py-2">
            <div class="fw-semibold mb-1">Created on the platform</div>
            <dl class="mb-ids font-monospace mb-0">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $campaign->external_ids; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $label => $id): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <dt><?php echo e(str_replace('_', ' ', $label)); ?></dt>
                    <dd><?php echo e(is_scalar($id) ? $id : json_encode($id)); ?></dd>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </dl>
        </div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($campaign->last_error): ?>
        <div class="alert alert-danger small py-2"><?php echo e($campaign->last_error); ?></div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($blocking): ?>
        <div class="small">
            
            <div class="text-body-secondary mb-1">Still needed to publish</div>
            <ul class="ps-3 mb-0">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $blocking; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $reason): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <li><?php echo e($reason); ?></li>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </ul>
        </div>
    <?php else: ?>
        <div class="alert alert-success small py-2 mb-0">Ready to publish.</div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
<?php /**PATH /var/www/php85/koushik/arb.admedia.com/resources/views/partials/campaign-panel.blade.php ENDPATH**/ ?>