sed -n '1,220p' /Users/fabianwesner/Herd/shop/.agents/skills/livewire-development/SKILL.md

---
name: livewire-development
description: "Use for any task or question involving Livewire. Activate if user mentions Livewire, wire: directives, or Livewire-specific concepts like wire:model, wire:click, wire:sort, or islands, invoke this skill. Covers building new components, debugging reactivity issues, real-time form validation, drag-and-drop, loading states, migrating from Livewire 3 to 4, converting component formats (SFC/MFC/class-based), and performance optimization. Do not use for non-Livewire reactive UI (React, Vue, Alpine-only, Inertia.js) or standard Laravel forms without Livewire."
license: MIT
metadata:
  author: laravel
---

# Livewire Development

## Documentation

Use `search-docs` for detailed Livewire 4 patterns and documentation.

## Basic Usage

### Creating Components

```bash

# Single-file component (SFC - default in v4)

# Creates: resources/views/components/⚡create-post.blade.php

php artisan make:livewire create-post

# Page component (SFC - Full Page in v4)

# Creates: resources/views/pages/⚡create-post.blade.php

php artisan make:livewire pages::create-post

# Multi-file component (MFC)

# Creates: resources/views/components/⚡create-post/create-post.php

#          resources/views/components/⚡create-post/create-post.blade.php

php artisan make:livewire create-post --mfc

# Class-based component (v3 style)

# Creates: app/Livewire/CreatePost.php AND resources/views/livewire/create-post.blade.php

php artisan make:livewire create-post --class

# With namespace

php artisan make:livewire Posts/CreatePost
```

### Converting Between Formats

Use `php artisan livewire:convert create-post` to convert between single-file, multi-file, and class-based formats.

### Choosing a Component Format

> **Always follow the project's existing conventions first.** Before creating any component, inspect the project's existing Livewire components to determine the established format (SFC, MFC, or class-based) and directory structure. Check `app/Livewire/`, `resources/views/components/`, and `resources/views/livewire/` for existing components. If the project already uses a consistent format, **use that same format** — even if it differs from the Livewire v4 defaults below. Only fall back to the v4 defaults (SFC in `resources/views/components/`) when no existing convention is established.

Also check `config/livewire.php` for `make_command.type`, `make_command.emoji`, `component_locations`, and `component_namespaces` overrides, which change the default format and where files are stored.

### Component Format Reference

| Format | Flag | Class Path | View Path |
|--------|------|------------|-----------|
| Single-file (SFC) | default | — | `resources/views/components/⚡create-post.blade.php` (PHP + Blade in one file) |
| Full Page SFC | `pages::name` | — | `resources/views/pages/⚡create-post.blade.php` |
| Multi-file (MFC) | `--mfc` | `resources/views/components/⚡create-post/create-post.php` | `resources/views/components/⚡create-post/create-post.blade.php` |
| Class-based | `--class` | `app/Livewire/CreatePost.php` | `resources/views/livewire/create-post.blade.php` |
| View-based | default (Blade-only) | — | `resources/views/components/⚡create-post.blade.php` (Blade-only with functional state) |

> **Important:** The ⚡ prefix shown above is the **default** behavior in Livewire v4 — it is **configurable**. Check `config/livewire.php` for the `make_command.emoji` setting. When `true` (default), always include the ⚡ prefix in filenames you create. When `false`, omit the ⚡ prefix from all paths above.

Namespaced components map to subdirectories: `make:livewire Posts/CreatePost` creates `resources/views/components/posts/⚡create-post.blade.php` (single-file by default). Use `make:livewire Posts/CreatePost --mfc` for multi-file output at `resources/views/components/posts/⚡create-post/create-post.php` and `resources/views/components/posts/⚡create-post/create-post.blade.php`.

### Single-File Component Example

<!-- Single-File Component Example -->
```php
<?php
use Livewire\Component;

new class extends Component {
    public int $count = 0;

    public function increment(): void
    {
        $this->count++;
    }
};
?>

<div>
    <button wire:click="increment">Count: @{{ $count }}</button>
</div>
```

## Livewire 4 Specifics

### Key Changes From Livewire 3

These things changed in Livewire 4, but may not have been updated in this application. Verify this application's setup to ensure you follow existing conventions.

- Use `Route::livewire()` for full-page components (e.g., `Route::livewire('/posts/create', CreatePost::class)`); config keys renamed: `layout` → `component_layout`, `lazy_placeholder` → `component_placeholder`.
- `wire:model` now ignores child events by default (use `wire:model.deep` for old behavior); `wire:scroll` renamed to `wire:navigate:scroll`.
- Component tags must be properly closed; `wire:transition` now uses View Transitions API (modifiers removed).
- JavaScript: `$wire.$js('name', fn)` → `$wire.$js.name = fn`; `commit`/`request` hooks → `interceptMessage()`/`interceptRequest()`.

### New Features

- Component formats: single-file (SFC), multi-file (MFC), view-based components.
- Islands (`@island`) for isolated updates; async actions (`wire:click.async`, `#[Async]`) for parallel execution.
- Deferred/bundled loading: `defer`, `lazy.bundle` for optimized component loading.

| Feature | Usage | Purpose |
|---------|-------|---------|
| Islands | `@island(name: 'stats')` | Isolated update regions |
| Async | `wire:click.async` or `#[Async]` | Non-blocking actions |
| Deferred | `defer` attribute | Load after page render |
| Bundled | `lazy.bundle` | Load multiple together |

### New Directives

- `wire:sort`, `wire:intersect`, `wire:ref`, `.renderless`, `.preserve-scroll` are available for use.
- `data-loading` attribute automatically added to elements triggering network requests.

| Directive | Purpose |
|-----------|---------|
| `wire:sort` | Drag-and-drop sorting |
| `wire:intersect` | Viewport intersection detection |
| `wire:ref` | Element references for JS |
| `.renderless` | Component without rendering |
| `.preserve-scroll` | Preserve scroll position |

## Best Practices

- Always use `wire:key` in loops
- Use `wire:loading` for loading states
- Use `wire:model.live` for instant updates (default is debounced)
- Validate and authorize in actions (treat like HTTP requests)

## Configuration

- `smart_wire_keys` defaults to `true`; new configs: `component_locations`, `component_namespaces`, `make_command`, `csp_safe`.

## Alpine & JavaScript

- `wire:transition` uses browser View Transitions API; `$errors` and `$intercept` magic properties available.
- Non-blocking `wire:poll` and parallel `wire:model.live` updates improve performance.

For interceptors and hooks, see [reference/javascript-hooks.md](reference/javascript-hooks.md).

## Testing

<!-- Testing Example -->
```php
Livewire::test(Counter::class)
    ->assertSet('count', 0)
    ->call('increment')
    ->assertSet('count', 1);
```

## Verification

1. Browser console: Check for JS errors
2. Network tab: Verify Livewire requests return 200
3. Ensure `wire:key` on all `@foreach` loops

## Common Pitfalls

- Missing `wire:key` in loops → unexpected re-rendering
- Expecting `wire:model` real-time → use `wire:model.live`
- Unclosed component tags → syntax errors in v4
- Using deprecated config keys or JS hooks
- Including Alpine.js separately (already bundled in Livewire 4)


Output:
Chunk ID: df54b2
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 1888
Output:
---
name: livewire-development
description: "Use for any task or question involving Livewire. Activate if user mentions Livewire, wire: directives, or Livewire-specific concepts like wire:model, wire:click, wire:sort, or islands, invoke this skill. Covers building new components, debugging reactivity issues, real-time form validation, drag-and-drop, loading states, migrating from Livewire 3 to 4, converting component formats (SFC/MFC/class-based), and performance optimization. Do not use for non-Livewire reactive UI (React, Vue, Alpine-only, Inertia.js) or standard Laravel forms without Livewire."
license: MIT
metadata:
  author: laravel
---

# Livewire Development

## Documentation

Use `search-docs` for detailed Livewire 4 patterns and documentation.

## Basic Usage

### Creating Components

```bash

# Single-file component (SFC - default in v4)

# Creates: resources/views/components/⚡create-post.blade.php

php artisan make:livewire create-post

# Page component (SFC - Full Page in v4)

# Creates: resources/views/pages/⚡create-post.blade.php

php artisan make:livewire pages::create-post

# Multi-file component (MFC)

# Creates: resources/views/components/⚡create-post/create-post.php

#          resources/views/components/⚡create-post/create-post.blade.php

php artisan make:livewire create-post --mfc

# Class-based component (v3 style)

# Creates: app/Livewire/CreatePost.php AND resources/views/livewire/create-post.blade.php

php artisan make:livewire create-post --class

# With namespace

php artisan make:livewire Posts/CreatePost
```

### Converting Between Formats

Use `php artisan livewire:convert create-post` to convert between single-file, multi-file, and class-based formats.

### Choosing a Component Format

> **Always follow the project's existing conventions first.** Before creating any component, inspect the project's existing Livewire components to determine the established format (SFC, MFC, or class-based) and directory structure. Check `app/Livewire/`, `resources/views/components/`, and `resources/views/livewire/` for existing components. If the project already uses a consistent format, **use that same format** — even if it differs from the Livewire v4 defaults below. Only fall back to the v4 defaults (SFC in `resources/views/components/`) when no existing convention is established.

Also check `config/livewire.php` for `make_command.type`, `make_command.emoji`, `component_locations`, and `component_namespaces` overrides, which change the default format and where files are stored.

### Component Format Reference

| Format | Flag | Class Path | View Path |
|--------|------|------------|-----------|
| Single-file (SFC) | default | — | `resources/views/components/⚡create-post.blade.php` (PHP + Blade in one file) |
| Full Page SFC | `pages::name` | — | `resources/views/pages/⚡create-post.blade.php` |
| Multi-file (MFC) | `--mfc` | `resources/views/components/⚡create-post/create-post.php` | `resources/views/components/⚡create-post/create-post.blade.php` |
| Class-based | `--class` | `app/Livewire/CreatePost.php` | `resources/views/livewire/create-post.blade.php` |
| View-based | default (Blade-only) | — | `resources/views/components/⚡create-post.blade.php` (Blade-only with functional state) |

> **Important:** The ⚡ prefix shown above is the **default** behavior in Livewire v4 — it is **configurable**. Check `config/livewire.php` for the `make_command.emoji` setting. When `true` (default), always include the ⚡ prefix in filenames you create. When `false`, omit the ⚡ prefix from all paths above.

Namespaced components map to subdirectories: `make:livewire Posts/CreatePost` creates `resources/views/components/posts/⚡create-post.blade.php` (single-file by default). Use `make:livewire Posts/CreatePost --mfc` for multi-file output at `resources/views/components/posts/⚡create-post/create-post.php` and `resources/views/components/posts/⚡create-post/create-post.blade.php`.

### Single-File Component Example

<!-- Single-File Component Example -->
```php
<?php
use Livewire\Component;

new class extends Component {
    public int $count = 0;

    public function increment(): void
    {
        $this->count++;
    }
};
?>

<div>
    <button wire:click="increment">Count: @{{ $count }}</button>
</div>
```

## Livewire 4 Specifics

### Key Changes From Livewire 3

These things changed in Livewire 4, but may not have been updated in this application. Verify this application's setup to ensure you follow existing conventions.

- Use `Route::livewire()` for full-page components (e.g., `Route::livewire('/posts/create', CreatePost::class)`); config keys renamed: `layout` → `component_layout`, `lazy_placeholder` → `component_placeholder`.
- `wire:model` now ignores child events by default (use `wire:model.deep` for old behavior); `wire:scroll` renamed to `wire:navigate:scroll`.
- Component tags must be properly closed; `wire:transition` now uses View Transitions API (modifiers removed).
- JavaScript: `$wire.$js('name', fn)` → `$wire.$js.name = fn`; `commit`/`request` hooks → `interceptMessage()`/`interceptRequest()`.

### New Features

- Component formats: single-file (SFC), multi-file (MFC), view-based components.
- Islands (`@island`) for isolated updates; async actions (`wire:click.async`, `#[Async]`) for parallel execution.
- Deferred/bundled loading: `defer`, `lazy.bundle` for optimized component loading.

| Feature | Usage | Purpose |
|---------|-------|---------|
| Islands | `@island(name: 'stats')` | Isolated update regions |
| Async | `wire:click.async` or `#[Async]` | Non-blocking actions |
| Deferred | `defer` attribute | Load after page render |
| Bundled | `lazy.bundle` | Load multiple together |

### New Directives

- `wire:sort`, `wire:intersect`, `wire:ref`, `.renderless`, `.preserve-scroll` are available for use.
- `data-loading` attribute automatically added to elements triggering network requests.

| Directive | Purpose |
|-----------|---------|
| `wire:sort` | Drag-and-drop sorting |
| `wire:intersect` | Viewport intersection detection |
| `wire:ref` | Element references for JS |
| `.renderless` | Component without rendering |
| `.preserve-scroll` | Preserve scroll position |

## Best Practices

- Always use `wire:key` in loops
- Use `wire:loading` for loading states
- Use `wire:model.live` for instant updates (default is debounced)
- Validate and authorize in actions (treat like HTTP requests)

## Configuration

- `smart_wire_keys` defaults to `true`; new configs: `component_locations`, `component_namespaces`, `make_command`, `csp_safe`.

## Alpine & JavaScript

- `wire:transition` uses browser View Transitions API; `$errors` and `$intercept` magic properties available.
- Non-blocking `wire:poll` and parallel `wire:model.live` updates improve performance.

For interceptors and hooks, see [reference/javascript-hooks.md](reference/javascript-hooks.md).

## Testing

<!-- Testing Example -->
```php
Livewire::test(Counter::class)
    ->assertSet('count', 0)
    ->call('increment')
    ->assertSet('count', 1);
```

## Verification

1. Browser console: Check for JS errors
2. Network tab: Verify Livewire requests return 200
3. Ensure `wire:key` on all `@foreach` loops

## Common Pitfalls

- Missing `wire:key` in loops → unexpected re-rendering
- Expecting `wire:model` real-time → use `wire:model.live`
- Unclosed component tags → syntax errors in v4
- Using deprecated config keys or JS hooks
- Including Alpine.js separately (already bundled in Livewire 4)


Output:
Chunk ID: 9a77cd
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 675
Output:
---
name: fluxui-development
description: "Use this skill for Flux UI development in Livewire applications only. Trigger when working with <flux:*> components, building or customizing Livewire component UIs, creating forms, modals, tables, or other interactive elements. Covers: flux: components (buttons, inputs, modals, forms, tables, date-pickers, kanban, badges, tooltips, etc.), component composition, Tailwind CSS styling, Heroicons/Lucide icon integration, validation patterns, responsive design, and theming. Do not use for non-Livewire frameworks or non-component styling."
license: MIT
metadata:
  author: laravel
---

# Flux UI Development

## Documentation

Use `search-docs` for detailed Flux UI patterns and documentation.

## Basic Usage

This project uses the free edition of Flux UI, which includes all free components and variants but not Pro components.

Flux UI is a component library for Livewire built with Tailwind CSS. It provides components that are easy to use and customize.

Use Flux UI components when available. Fall back to standard Blade components when no Flux component exists for your needs.

<!-- Basic Button -->
```blade
<flux:button variant="primary">Click me</flux:button>
```

## Available Components (Free Edition)

Available: avatar, badge, brand, breadcrumbs, button, callout, checkbox, dropdown, field, heading, icon, input, modal, navbar, otp-input, profile, radio, select, separator, skeleton, switch, text, textarea, tooltip

## Icons

Flux includes [Heroicons](https://heroicons.com/) as its default icon set. Search for exact icon names on the Heroicons site - do not guess or invent icon names.

<!-- Icon Button -->
```blade
<flux:button icon="arrow-down-tray">Export</flux:button>
```

For icons not available in Heroicons, use [Lucide](https://lucide.dev/). Import the icons you need with the Artisan command:

```bash
php artisan flux:icon crown grip-vertical github
```

## Common Patterns

### Form Fields

<!-- Form Field -->
```blade
<flux:field>
    <flux:label>Email</flux:label>
    <flux:input type="email" wire:model="email" />
    <flux:error name="email" />
</flux:field>
```

### Modals

<!-- Modal -->
```blade
<flux:modal wire:model="showModal">
    <flux:heading>Title</flux:heading>
    <p>Content</p>
</flux:modal>
```

## Verification

1. Check component renders correctly
2. Test interactive states
3. Verify mobile responsiveness

## Common Pitfalls

- Trying to use Pro-only components in the free edition
- Not checking if a Flux component exists before creating custom implementations
- Forgetting to use the `search-docs` tool for component-specific documentation
- Not following existing project patterns for Flux usage


Output:
Chunk ID: fbd09b
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 962
Output:
---
name: tailwindcss-development
description: "Always invoke when the user's message includes 'tailwind' in any form. Also invoke for: building responsive grid layouts (multi-column card grids, product grids), flex/grid page structures (dashboards with sidebars, fixed topbars, mobile-toggle navs), styling UI components (cards, tables, navbars, pricing sections, forms, inputs, badges), adding dark mode variants, fixing spacing or typography, and Tailwind v3/v4 work. The core use case: writing or fixing Tailwind utility classes in HTML templates (Blade, JSX, Vue). Skip for backend PHP logic, database queries, API routes, JavaScript with no HTML/CSS component, CSS file audits, build tool configuration, and vanilla CSS."
license: MIT
metadata:
  author: laravel
---

# Tailwind CSS Development

## Documentation

Use `search-docs` for detailed Tailwind CSS v4 patterns and documentation.

## Basic Usage

- Use Tailwind CSS classes to style HTML. Check and follow existing Tailwind conventions in the project before introducing new patterns.
- Offer to extract repeated patterns into components that match the project's conventions (e.g., Blade, JSX, Vue).
- Consider class placement, order, priority, and defaults. Remove redundant classes, add classes to parent or child elements carefully to reduce repetition, and group elements logically.

## Tailwind CSS v4 Specifics

- Always use Tailwind CSS v4 and avoid deprecated utilities.
- `corePlugins` is not supported in Tailwind v4.

### CSS-First Configuration

In Tailwind v4, configuration is CSS-first using the `@theme` directive — no separate `tailwind.config.js` file is needed:

<!-- CSS-First Config -->
```css
@theme {
  --color-brand: oklch(0.72 0.11 178);
}
```

### Import Syntax

In Tailwind v4, import Tailwind with a regular CSS `@import` statement instead of the `@tailwind` directives used in v3:

<!-- v4 Import Syntax -->
```diff
- @tailwind base;
- @tailwind components;
- @tailwind utilities;
+ @import "tailwindcss";
```

### Replaced Utilities

Tailwind v4 removed deprecated utilities. Use the replacements shown below. Opacity values remain numeric.

| Deprecated | Replacement |
|------------|-------------|
| bg-opacity-* | bg-black/* |
| text-opacity-* | text-black/* |
| border-opacity-* | border-black/* |
| divide-opacity-* | divide-black/* |
| ring-opacity-* | ring-black/* |
| placeholder-opacity-* | placeholder-black/* |
| flex-shrink-* | shrink-* |
| flex-grow-* | grow-* |
| overflow-ellipsis | text-ellipsis |
| decoration-slice | box-decoration-slice |
| decoration-clone | box-decoration-clone |

## Spacing

Use `gap` utilities instead of margins for spacing between siblings:

<!-- Gap Utilities -->
```html
<div class="flex gap-8">
    <div>Item 1</div>
    <div>Item 2</div>
</div>
```

## Dark Mode

If existing pages and components support dark mode, new pages and components must support it the same way, typically using the `dark:` variant:

<!-- Dark Mode -->
```html
<div class="bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
    Content adapts to color scheme
</div>
```

## Common Patterns

### Flexbox Layout

<!-- Flexbox Layout -->
```html
<div class="flex items-center justify-between gap-4">
    <div>Left content</div>
    <div>Right content</div>
</div>
```

### Grid Layout

<!-- Grid Layout -->
```html
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
    <div>Card 1</div>
    <div>Card 2</div>
    <div>Card 3</div>
</div>
```

## Common Pitfalls

- Using deprecated v3 utilities (bg-opacity-*, flex-shrink-*, etc.)
- Using `@tailwind` directives instead of `@import "tailwindcss"`
- Trying to use `tailwind.config.js` instead of CSS `@theme` directive
- Using margins for spacing between siblings instead of gap utilities
- Forgetting to add dark mode variants when the project uses dark mode


Output:
Chunk ID: f90e7a
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 0
Output:


Using Livewire, Flux UI, Tailwind, Laravel best-practices, and Pest skills for this UI/service test slice. I’m reading the existing cart component/view and pricing services so the estimate and discount controls reuse the current checkout logic instead of inventing a second pricing path.


sed -n '1,260p' app/Livewire/Storefront/Cart/Show.php


sed -n '1,320p' resources/views/livewire/storefront/cart/show.blade.php


sed -n '1,340p' app/Livewire/Storefront/Checkout/Show.php


sed -n '1,300p' resources/views/livewire/storefront/cart-drawer.blade.php


sed -n '1,240p' tests/Feature/Storefront/CartCheckoutUiTest.php


sed -n '1,260p' app/Livewire/Storefront/Cart/Show.php

<?php

namespace App\Livewire\Storefront\Cart;

use App\Models\Cart;
use App\Models\CartLine;
use App\Models\Customer;
use App\Models\Store;
use App\Services\CartService;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Livewire\Attributes\On;
use Livewire\Component;

class Show extends Component
{
    public int $storeId;

    public function mount(): void
    {
        $this->storeId = $this->store()->getKey();
    }

    #[On('cart-updated')]
    public function refreshCart(): void {}

    public function increaseQuantity(int $lineId): void
    {
        $line = $this->cartLine($lineId);

        if (! $line instanceof CartLine) {
            return;
        }

        app(CartService::class)->updateLineQuantity($line->cart, $line->getKey(), $line->quantity + 1);
        $this->dispatch('cart-updated');
    }

    public function decreaseQuantity(int $lineId): void
    {
        $line = $this->cartLine($lineId);

        if (! $line instanceof CartLine) {
            return;
        }

        app(CartService::class)->updateLineQuantity($line->cart, $line->getKey(), $line->quantity - 1);
        $this->dispatch('cart-updated');
    }

    public function removeLine(int $lineId): void
    {
        $line = $this->cartLine($lineId);

        if (! $line instanceof CartLine) {
            return;
        }

        app(CartService::class)->removeLine($line->cart, $line->getKey());
        $this->dispatch('cart-updated');
    }

    public function checkout(): void
    {
        if ($this->lineCount() === 0) {
            return;
        }

        $this->redirectRoute('checkout.show', navigate: true);
    }

    public function store(): Store
    {
        if (isset($this->storeId)) {
            $store = Store::query()->findOrFail($this->storeId);
            app()->instance('current_store', $store);

            return $store;
        }

        $store = app('current_store');

        abort_unless($store instanceof Store, 404);

        return $store;
    }

    public function cart(): ?Cart
    {
        $cart = app(CartService::class)->currentForSession($this->store(), $this->customer());

        return $cart?->load([
            'lines.variant.product',
            'lines.variant.optionValues.option',
        ]);
    }

    /**
     * @return Collection<int, CartLine>
     */
    public function lines(): Collection
    {
        return $this->cart()?->lines->sortBy('id')->values() ?? collect();
    }

    public function lineCount(): int
    {
        return $this->lines()->sum('quantity');
    }

    public function subtotal(): int
    {
        return $this->lines()->sum('line_subtotal_amount');
    }

    public function render(): mixed
    {
        return view('livewire.storefront.cart.show', [
            'cart' => $this->cart(),
            'lines' => $this->lines(),
            'lineCount' => $this->lineCount(),
            'subtotal' => $this->subtotal(),
        ])->layout('layouts.storefront', [
            'title' => 'Cart',
        ]);
    }

    private function customer(): ?Customer
    {
        $customer = Auth::guard('customer')->user();

        return $customer instanceof Customer ? $customer : null;
    }

    private function cartLine(int $lineId): ?CartLine
    {
        return $this->lines()->firstWhere('id', $lineId);
    }
}


Output:
Chunk ID: 2d659c
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 836
Output:
<?php

namespace App\Livewire\Storefront\Cart;

use App\Models\Cart;
use App\Models\CartLine;
use App\Models\Customer;
use App\Models\Store;
use App\Services\CartService;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Livewire\Attributes\On;
use Livewire\Component;

class Show extends Component
{
    public int $storeId;

    public function mount(): void
    {
        $this->storeId = $this->store()->getKey();
    }

    #[On('cart-updated')]
    public function refreshCart(): void {}

    public function increaseQuantity(int $lineId): void
    {
        $line = $this->cartLine($lineId);

        if (! $line instanceof CartLine) {
            return;
        }

        app(CartService::class)->updateLineQuantity($line->cart, $line->getKey(), $line->quantity + 1);
        $this->dispatch('cart-updated');
    }

    public function decreaseQuantity(int $lineId): void
    {
        $line = $this->cartLine($lineId);

        if (! $line instanceof CartLine) {
            return;
        }

        app(CartService::class)->updateLineQuantity($line->cart, $line->getKey(), $line->quantity - 1);
        $this->dispatch('cart-updated');
    }

    public function removeLine(int $lineId): void
    {
        $line = $this->cartLine($lineId);

        if (! $line instanceof CartLine) {
            return;
        }

        app(CartService::class)->removeLine($line->cart, $line->getKey());
        $this->dispatch('cart-updated');
    }

    public function checkout(): void
    {
        if ($this->lineCount() === 0) {
            return;
        }

        $this->redirectRoute('checkout.show', navigate: true);
    }

    public function store(): Store
    {
        if (isset($this->storeId)) {
            $store = Store::query()->findOrFail($this->storeId);
            app()->instance('current_store', $store);

            return $store;
        }

        $store = app('current_store');

        abort_unless($store instanceof Store, 404);

        return $store;
    }

    public function cart(): ?Cart
    {
        $cart = app(CartService::class)->currentForSession($this->store(), $this->customer());

        return $cart?->load([
            'lines.variant.product',
            'lines.variant.optionValues.option',
        ]);
    }

    /**
     * @return Collection<int, CartLine>
     */
    public function lines(): Collection
    {
        return $this->cart()?->lines->sortBy('id')->values() ?? collect();
    }

    public function lineCount(): int
    {
        return $this->lines()->sum('quantity');
    }

    public function subtotal(): int
    {
        return $this->lines()->sum('line_subtotal_amount');
    }

    public function render(): mixed
    {
        return view('livewire.storefront.cart.show', [
            'cart' => $this->cart(),
            'lines' => $this->lines(),
            'lineCount' => $this->lineCount(),
            'subtotal' => $this->subtotal(),
        ])->layout('layouts.storefront', [
            'title' => 'Cart',
        ]);
    }

    private function customer(): ?Customer
    {
        $customer = Auth::guard('customer')->user();

        return $customer instanceof Customer ? $customer : null;
    }

    private function cartLine(int $lineId): ?CartLine
    {
        return $this->lines()->firstWhere('id', $lineId);
    }
}


sed -n '1,320p' resources/views/livewire/storefront/cart/show.blade.php

    <x-storefront.breadcrumbs :items="[['label' => 'Cart']]" />

Cart

{{ $lineCount }} {{ Str::plural('item', $lineCount) }}

                <flux:button :href="route('collections.index')" wire:navigate variant="ghost" icon="arrow-left">
                    Continue shopping
                </flux:button>

            @if ($lines->isEmpty())

                    <flux:icon name="shopping-bag" class="mx-auto size-12 text-zinc-400 dark:text-zinc-600" />

Your cart is empty

                    <flux:button :href="route('collections.index')" wire:navigate variant="primary" class="mt-6">
                        Browse products
                    </flux:button>

            @else

                    @foreach ($lines as $line)

getKey() }}">
                            variant->product->handle) }}" wire:navigate class="flex aspect-square items-center justify-center rounded-md border border-zinc-200 bg-zinc-100 text-zinc-400 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-600">
                                <flux:icon name="shopping-bag" class="size-7" />

                                variant->product->handle) }}" wire:navigate class="font-medium text-zinc-950 hover:underline dark:text-white">
                                    {{ $line->variant->product->title }}

                                    {{ $line->variant->optionValues->map(fn ($value) => $value->option->name.': '.$value->value)->implode(' / ') ?: ($line->variant->sku ?: 'Default') }}

                                <x-storefront.price :amount="$line->unit_price_amount" :currency="$cart->currency" class="text-sm" />

                                    <button type="button" wire:click="decreaseQuantity({{ $line->getKey() }})" class="flex size-10 items-center justify-center border-r border-zinc-200 text-sm dark:border-zinc-700" aria-label="Decrease {{ $line->variant->product->title }} quantity">-</button>
                                    {{ $line->quantity }}
                                    <button type="button" wire:click="increaseQuantity({{ $line->getKey() }})" class="flex size-10 items-center justify-center border-l border-zinc-200 text-sm dark:border-zinc-700" aria-label="Increase {{ $line->variant->product->title }} quantity">+</button>

                                    <x-storefront.price :amount="$line->line_total_amount" :currency="$cart->currency" class="justify-end" />
                                    <flux:button wire:click="removeLine({{ $line->getKey() }})" variant="ghost" size="sm" icon="trash" class="mt-2" aria-label="Remove {{ $line->variant->product->title }}" />

                    @endforeach

            @endif

Summary

                    Subtotal
                    @if ($cart)
                        <x-storefront.price :amount="$subtotal" :currency="$cart->currency" />
                    @else
                        -
                    @endif

                    Shipping
                    Checkout

            <flux:button wire:click="checkout" variant="primary" class="mt-6 w-full" :disabled="$lineCount === 0">
                Checkout
            </flux:button>


sed -n '1,340p' app/Livewire/Storefront/Checkout/Show.php

<?php

namespace App\Livewire\Storefront\Checkout;

use App\Enums\CheckoutStatus;
use App\Exceptions\InvalidCheckoutTransitionException;
use App\Exceptions\InvalidDiscountException;
use App\Exceptions\UnserviceableShippingAddressException;
use App\Models\Cart;
use App\Models\CartLine;
use App\Models\Checkout;
use App\Models\Customer;
use App\Models\ShippingRate;
use App\Models\Store;
use App\Services\CartService;
use App\Services\CheckoutService;
use App\Services\PricingEngine;
use App\Services\ShippingCalculator;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
use Livewire\Component;

class Show extends Component
{
    public int $storeId;

    public string $step = 'address';

    public string $email = '';

    /**
     * @var array<string, string>
     */
    public array $shippingAddress = [
        'first_name' => '',
        'last_name' => '',
        'address1' => '',
        'address2' => '',
        'city' => '',
        'province_code' => '',
        'country' => 'DE',
        'postal_code' => '',
    ];

    /**
     * @var array<string, string>
     */
    public array $billingAddress = [
        'first_name' => '',
        'last_name' => '',
        'address1' => '',
        'address2' => '',
        'city' => '',
        'province_code' => '',
        'country' => 'DE',
        'postal_code' => '',
    ];

    public bool $billingSame = true;

    public ?int $selectedShippingRateId = null;

    public string $discountCode = '';

    public string $paymentMethod = 'credit_card';

    public function mount(): void
    {
        $this->storeId = $this->store()->getKey();
        $this->email = $this->customer()?->email ?? '';

        $this->fillFromCheckout($this->checkout());
    }

    public function saveAddress(): void
    {
        $this->validate([
            'email' => ['required', 'email'],
            'shippingAddress.first_name' => ['required', 'string'],
            'shippingAddress.last_name' => ['required', 'string'],
            'shippingAddress.address1' => ['required', 'string'],
            'shippingAddress.city' => ['required', 'string'],
            'shippingAddress.country' => ['required', 'string', 'size:2'],
            'shippingAddress.postal_code' => ['required', 'string'],
            'billingSame' => ['boolean'],
        ]);

        $checkout = $this->checkout();

        if (! $checkout instanceof Checkout) {
            return;
        }

        try {
            $checkout = app(CheckoutService::class)->setAddress($checkout, [
                'email' => $this->email,
                'shipping_address' => $this->shippingAddress,
                'billing_address' => $this->billingSame ? $this->shippingAddress : $this->billingAddress,
            ]);

            $this->selectedShippingRateId = null;

            if (! $this->requiresShipping()) {
                app(CheckoutService::class)->setShippingMethod($checkout, null);
                $this->step = 'payment';

                return;
            }

            $this->step = 'shipping';
        } catch (InvalidCheckoutTransitionException $exception) {
            throw ValidationException::withMessages([
                'email' => $exception->getMessage(),
            ]);
        }
    }

    public function selectShippingMethod(): void
    {
        $checkout = $this->checkout();

        if (! $checkout instanceof Checkout) {
            return;
        }

        if ($this->requiresShipping()) {
            $this->validate([
                'selectedShippingRateId' => ['required', 'integer'],
            ]);
        }

        try {
            app(CheckoutService::class)->setShippingMethod($checkout, $this->selectedShippingRateId);
            $this->step = 'payment';
        } catch (InvalidCheckoutTransitionException|UnserviceableShippingAddressException $exception) {
            throw ValidationException::withMessages([
                'selectedShippingRateId' => $exception->getMessage(),
            ]);
        }
    }

    public function applyDiscount(): void
    {
        $checkout = $this->checkout();

        if (! $checkout instanceof Checkout) {
            return;
        }

        $checkout->forceFill([
            'discount_code' => trim($this->discountCode) !== '' ? trim($this->discountCode) : null,
        ])->save();

        try {
            app(PricingEngine::class)->calculate($checkout);
            $this->resetErrorBag('discountCode');
        } catch (InvalidDiscountException $exception) {
            $checkout->forceFill(['discount_code' => null])->save();
            $this->discountCode = '';
            app(PricingEngine::class)->calculate($checkout);

            throw ValidationException::withMessages([
                'discountCode' => $exception->getMessage(),
            ]);
        }
    }

    public function selectPaymentMethod(): void
    {
        $this->validate([
            'paymentMethod' => ['required', 'in:credit_card,paypal,bank_transfer'],
        ]);

        $checkout = $this->checkout();

        if (! $checkout instanceof Checkout) {
            return;
        }

        try {
            app(CheckoutService::class)->selectPaymentMethod($checkout, $this->paymentMethod);
            $this->step = 'reserved';
        } catch (InvalidCheckoutTransitionException $exception) {
            throw ValidationException::withMessages([
                'paymentMethod' => $exception->getMessage(),
            ]);
        }
    }

    public function store(): Store
    {
        if (isset($this->storeId)) {
            $store = Store::query()->findOrFail($this->storeId);
            app()->instance('current_store', $store);

            return $store;
        }

        $store = app('current_store');

        abort_unless($store instanceof Store, 404);

        return $store;
    }

    public function cart(): ?Cart
    {
        $cart = app(CartService::class)->currentForSession($this->store(), $this->customer());

        return $cart?->load([
            'lines.variant.product',
            'lines.variant.optionValues.option',
        ]);
    }

    public function checkout(): ?Checkout
    {
        $cart = $this->cart();

        if (! $cart instanceof Cart || $cart->lines->isEmpty()) {
            return null;
        }

        $checkout = Checkout::withoutGlobalScopes()
            ->where('cart_id', $cart->getKey())
            ->whereNotIn('status', [CheckoutStatus::Completed->value, CheckoutStatus::Expired->value])
            ->latest('id')
            ->first();

        if (! $checkout instanceof Checkout) {
            $checkout = app(CheckoutService::class)->createFromCart($cart, $this->customer());
        }

        return $checkout->load(['cart.lines.variant.product', 'cart.lines.variant.optionValues.option']);
    }

    /**
     * @return Collection<int, CartLine>
     */
    public function lines(): Collection
    {
        return $this->cart()?->lines->sortBy('id')->values() ?? collect();
    }

    /**
     * @return Collection<int, ShippingRate>
     */
    public function availableRates(): Collection
    {
        if ($this->shippingAddress['country'] === '') {
            return collect();
        }

        return app(ShippingCalculator::class)->getAvailableRates($this->store(), $this->shippingAddress);
    }

    public function requiresShipping(): bool
    {
        $cart = $this->cart();

        return $cart instanceof Cart && app(ShippingCalculator::class)->requiresShipping($cart);
    }

    /**
     * @return array<int, int>
     */
    public function shippingRateAmounts(): array
    {
        $cart = $this->cart();

        if (! $cart instanceof Cart) {
            return [];
        }

        return $this->availableRates()
            ->mapWithKeys(fn (ShippingRate $rate): array => [
                $rate->getKey() => app(ShippingCalculator::class)->calculate($rate, $cart) ?? 0,
            ])
            ->all();
    }

    public function lineCount(): int
    {
        return $this->lines()->sum('quantity');
    }

    public function subtotal(): int
    {
        return $this->lines()->sum('line_subtotal_amount');
    }

    /**
     * @return array<string, mixed>
     */
    public function totals(): array
    {
        $cart = $this->cart();

        return $this->checkout()?->totals_json ?? [
            'subtotal' => $this->subtotal(),
            'discount' => 0,
            'shipping' => 0,
            'tax' => 0,
            'total' => $this->subtotal(),
            'currency' => $cart?->currency ?? $this->store()->default_currency,
        ];
    }

    public function render(): mixed
    {
        return view('livewire.storefront.checkout.show', [
            'cart' => $this->cart(),
            'checkout' => $this->checkout(),
            'lines' => $this->lines(),
            'lineCount' => $this->lineCount(),
            'rates' => $this->availableRates(),
            'rateAmounts' => $this->shippingRateAmounts(),
            'requiresShipping' => $this->requiresShipping(),
            'totals' => $this->totals(),
        ])->layout('layouts.storefront', [
            'title' => 'Checkout',
        ]);
    }

    private function customer(): ?Customer
    {
        $customer = Auth::guard('customer')->user();

        return $customer instanceof Customer ? $customer : null;
    }

    private function fillFromCheckout(?Checkout $checkout): void
    {
        if (! $checkout instanceof Checkout) {
            return;
        }

        $this->email = $checkout->email ?: $this->email;
        $this->shippingAddress = array_replace($this->shippingAddress, $checkout->shipping_address_json ?? []);


Output:
Chunk ID: 006226
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 1440
Output:

    <x-storefront.breadcrumbs :items="[['label' => 'Cart']]" />

Cart

{{ $lineCount }} {{ Str::plural('item', $lineCount) }}

                <flux:button :href="route('collections.index')" wire:navigate variant="ghost" icon="arrow-left">
                    Continue shopping
                </flux:button>

            @if ($lines->isEmpty())

                    <flux:icon name="shopping-bag" class="mx-auto size-12 text-zinc-400 dark:text-zinc-600" />

Your cart is empty

                    <flux:button :href="route('collections.index')" wire:navigate variant="primary" class="mt-6">
                        Browse products
                    </flux:button>

            @else

                    @foreach ($lines as $line)

getKey() }}">
                            variant->product->handle) }}" wire:navigate class="flex aspect-square items-center justify-center rounded-md border border-zinc-200 bg-zinc-100 text-zinc-400 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-600">
                                <flux:icon name="shopping-bag" class="size-7" />

                                variant->product->handle) }}" wire:navigate class="font-medium text-zinc-950 hover:underline dark:text-white">
                                    {{ $line->variant->product->title }}

                                    {{ $line->variant->optionValues->map(fn ($value) => $value->option->name.': '.$value->value)->implode(' / ') ?: ($line->variant->sku ?: 'Default') }}

                                <x-storefront.price :amount="$line->unit_price_amount" :currency="$cart->currency" class="text-sm" />

                                    <button type="button" wire:click="decreaseQuantity({{ $line->getKey() }})" class="flex size-10 items-center justify-center border-r border-zinc-200 text-sm dark:border-zinc-700" aria-label="Decrease {{ $line->variant->product->title }} quantity">-</button>
                                    {{ $line->quantity }}
                                    <button type="button" wire:click="increaseQuantity({{ $line->getKey() }})" class="flex size-10 items-center justify-center border-l border-zinc-200 text-sm dark:border-zinc-700" aria-label="Increase {{ $line->variant->product->title }} quantity">+</button>

                                    <x-storefront.price :amount="$line->line_total_amount" :currency="$cart->currency" class="justify-end" />
                                    <flux:button wire:click="removeLine({{ $line->getKey() }})" variant="ghost" size="sm" icon="trash" class="mt-2" aria-label="Remove {{ $line->variant->product->title }}" />

                    @endforeach

            @endif

Summary

                    Subtotal
                    @if ($cart)
                        <x-storefront.price :amount="$subtotal" :currency="$cart->currency" />
                    @else
                        -
                    @endif

                    Shipping
                    Checkout

            <flux:button wire:click="checkout" variant="primary" class="mt-6 w-full" :disabled="$lineCount === 0">
                Checkout
            </flux:button>


Output:
Chunk ID: 564c75
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 2435
Output:
<?php

namespace App\Livewire\Storefront\Checkout;

use App\Enums\CheckoutStatus;
use App\Exceptions\InvalidCheckoutTransitionException;
use App\Exceptions\InvalidDiscountException;
use App\Exceptions\UnserviceableShippingAddressException;
use App\Models\Cart;
use App\Models\CartLine;
use App\Models\Checkout;
use App\Models\Customer;
use App\Models\ShippingRate;
use App\Models\Store;
use App\Services\CartService;
use App\Services\CheckoutService;
use App\Services\PricingEngine;
use App\Services\ShippingCalculator;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
use Livewire\Component;

class Show extends Component
{
    public int $storeId;

    public string $step = 'address';

    public string $email = '';

    /**
     * @var array<string, string>
     */
    public array $shippingAddress = [
        'first_name' => '',
        'last_name' => '',
        'address1' => '',
        'address2' => '',
        'city' => '',
        'province_code' => '',
        'country' => 'DE',
        'postal_code' => '',
    ];

    /**
     * @var array<string, string>
     */
    public array $billingAddress = [
        'first_name' => '',
        'last_name' => '',
        'address1' => '',
        'address2' => '',
        'city' => '',
        'province_code' => '',
        'country' => 'DE',
        'postal_code' => '',
    ];

    public bool $billingSame = true;

    public ?int $selectedShippingRateId = null;

    public string $discountCode = '';

    public string $paymentMethod = 'credit_card';

    public function mount(): void
    {
        $this->storeId = $this->store()->getKey();
        $this->email = $this->customer()?->email ?? '';

        $this->fillFromCheckout($this->checkout());
    }

    public function saveAddress(): void
    {
        $this->validate([
            'email' => ['required', 'email'],
            'shippingAddress.first_name' => ['required', 'string'],
            'shippingAddress.last_name' => ['required', 'string'],
            'shippingAddress.address1' => ['required', 'string'],
            'shippingAddress.city' => ['required', 'string'],
            'shippingAddress.country' => ['required', 'string', 'size:2'],
            'shippingAddress.postal_code' => ['required', 'string'],
            'billingSame' => ['boolean'],
        ]);

        $checkout = $this->checkout();

        if (! $checkout instanceof Checkout) {
            return;
        }

        try {
            $checkout = app(CheckoutService::class)->setAddress($checkout, [
                'email' => $this->email,
                'shipping_address' => $this->shippingAddress,
                'billing_address' => $this->billingSame ? $this->shippingAddress : $this->billingAddress,
            ]);

            $this->selectedShippingRateId = null;

            if (! $this->requiresShipping()) {
                app(CheckoutService::class)->setShippingMethod($checkout, null);
                $this->step = 'payment';

                return;
            }

            $this->step = 'shipping';
        } catch (InvalidCheckoutTransitionException $exception) {
            throw ValidationException::withMessages([
                'email' => $exception->getMessage(),
            ]);
        }
    }

    public function selectShippingMethod(): void
    {
        $checkout = $this->checkout();

        if (! $checkout instanceof Checkout) {
            return;
        }

        if ($this->requiresShipping()) {
            $this->validate([
                'selectedShippingRateId' => ['required', 'integer'],
            ]);
        }

        try {
            app(CheckoutService::class)->setShippingMethod($checkout, $this->selectedShippingRateId);
            $this->step = 'payment';
        } catch (InvalidCheckoutTransitionException|UnserviceableShippingAddressException $exception) {
            throw ValidationException::withMessages([
                'selectedShippingRateId' => $exception->getMessage(),
            ]);
        }
    }

    public function applyDiscount(): void
    {
        $checkout = $this->checkout();

        if (! $checkout instanceof Checkout) {
            return;
        }

        $checkout->forceFill([
            'discount_code' => trim($this->discountCode) !== '' ? trim($this->discountCode) : null,
        ])->save();

        try {
            app(PricingEngine::class)->calculate($checkout);
            $this->resetErrorBag('discountCode');
        } catch (InvalidDiscountException $exception) {
            $checkout->forceFill(['discount_code' => null])->save();
            $this->discountCode = '';
            app(PricingEngine::class)->calculate($checkout);

            throw ValidationException::withMessages([
                'discountCode' => $exception->getMessage(),
            ]);
        }
    }

    public function selectPaymentMethod(): void
    {
        $this->validate([
            'paymentMethod' => ['required', 'in:credit_card,paypal,bank_transfer'],
        ]);

        $checkout = $this->checkout();

        if (! $checkout instanceof Checkout) {
            return;
        }

        try {
            app(CheckoutService::class)->selectPaymentMethod($checkout, $this->paymentMethod);
            $this->step = 'reserved';
        } catch (InvalidCheckoutTransitionException $exception) {
            throw ValidationException::withMessages([
                'paymentMethod' => $exception->getMessage(),
            ]);
        }
    }

    public function store(): Store
    {
        if (isset($this->storeId)) {
            $store = Store::query()->findOrFail($this->storeId);
            app()->instance('current_store', $store);

            return $store;
        }

        $store = app('current_store');

        abort_unless($store instanceof Store, 404);

        return $store;
    }

    public function cart(): ?Cart
    {
        $cart = app(CartService::class)->currentForSession($this->store(), $this->customer());

        return $cart?->load([
            'lines.variant.product',
            'lines.variant.optionValues.option',
        ]);
    }

    public function checkout(): ?Checkout
    {
        $cart = $this->cart();

        if (! $cart instanceof Cart || $cart->lines->isEmpty()) {
            return null;
        }

        $checkout = Checkout::withoutGlobalScopes()
            ->where('cart_id', $cart->getKey())
            ->whereNotIn('status', [CheckoutStatus::Completed->value, CheckoutStatus::Expired->value])
            ->latest('id')
            ->first();

        if (! $checkout instanceof Checkout) {
            $checkout = app(CheckoutService::class)->createFromCart($cart, $this->customer());
        }

        return $checkout->load(['cart.lines.variant.product', 'cart.lines.variant.optionValues.option']);
    }

    /**
     * @return Collection<int, CartLine>
     */
    public function lines(): Collection
    {
        return $this->cart()?->lines->sortBy('id')->values() ?? collect();
    }

    /**
     * @return Collection<int, ShippingRate>
     */
    public function availableRates(): Collection
    {
        if ($this->shippingAddress['country'] === '') {
            return collect();
        }

        return app(ShippingCalculator::class)->getAvailableRates($this->store(), $this->shippingAddress);
    }

    public function requiresShipping(): bool
    {
        $cart = $this->cart();

        return $cart instanceof Cart && app(ShippingCalculator::class)->requiresShipping($cart);
    }

    /**
     * @return array<int, int>
     */
    public function shippingRateAmounts(): array
    {
        $cart = $this->cart();

        if (! $cart instanceof Cart) {
            return [];
        }

        return $this->availableRates()
            ->mapWithKeys(fn (ShippingRate $rate): array => [
                $rate->getKey() => app(ShippingCalculator::class)->calculate($rate, $cart) ?? 0,
            ])
            ->all();
    }

    public function lineCount(): int
    {
        return $this->lines()->sum('quantity');
    }

    public function subtotal(): int
    {
        return $this->lines()->sum('line_subtotal_amount');
    }

    /**
     * @return array<string, mixed>
     */
    public function totals(): array
    {
        $cart = $this->cart();

        return $this->checkout()?->totals_json ?? [
            'subtotal' => $this->subtotal(),
            'discount' => 0,
            'shipping' => 0,
            'tax' => 0,
            'total' => $this->subtotal(),
            'currency' => $cart?->currency ?? $this->store()->default_currency,
        ];
    }

    public function render(): mixed
    {
        return view('livewire.storefront.checkout.show', [
            'cart' => $this->cart(),
            'checkout' => $this->checkout(),
            'lines' => $this->lines(),
            'lineCount' => $this->lineCount(),
            'rates' => $this->availableRates(),
            'rateAmounts' => $this->shippingRateAmounts(),
            'requiresShipping' => $this->requiresShipping(),
            'totals' => $this->totals(),
        ])->layout('layouts.storefront', [
            'title' => 'Checkout',
        ]);
    }

    private function customer(): ?Customer
    {
        $customer = Auth::guard('customer')->user();

        return $customer instanceof Customer ? $customer : null;
    }

    private function fillFromCheckout(?Checkout $checkout): void
    {
        if (! $checkout instanceof Checkout) {
            return;
        }

        $this->email = $checkout->email ?: $this->email;
        $this->shippingAddress = array_replace($this->shippingAddress, $checkout->shipping_address_json ?? []);


sed -n '1,300p' resources/views/livewire/storefront/cart-drawer.blade.php

<flux:modal name="cart-drawer" class="md:w-[32rem]">

                <flux:heading size="lg">Cart</flux:heading>
                <flux:text class="mt-1">{{ $lineCount }} {{ Str::plural('item', $lineCount) }}</flux:text>

            <flux:button :href="route('cart.show')" wire:navigate variant="subtle" size="sm" icon="shopping-bag">
                View cart
            </flux:button>

        @if ($lines->isEmpty())

                <flux:icon name="shopping-bag" class="mx-auto size-10 text-zinc-400 dark:text-zinc-600" />

Your cart is empty.

                <flux:button :href="route('collections.index')" wire:navigate variant="primary" class="mt-5">
                    Browse products
                </flux:button>

        @else

                @foreach ($lines as $line)

getKey() }}">
                        variant->product->handle) }}" wire:navigate class="flex size-16 shrink-0 items-center justify-center rounded-md border border-zinc-200 bg-zinc-100 text-zinc-400 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-600">
                            <flux:icon name="shopping-bag" class="size-6" />

                                    variant->product->handle) }}" wire:navigate class="line-clamp-2 text-sm font-medium text-zinc-950 hover:underline dark:text-white">
                                        {{ $line->variant->product->title }}

                                        {{ $line->variant->optionValues->map(fn ($value) => $value->option->name.': '.$value->value)->implode(' / ') ?: ($line->variant->sku ?: 'Default') }}

                                <x-storefront.price :amount="$line->line_total_amount" :currency="$cart->currency" class="justify-end text-sm" />

                                    <button type="button" wire:click="decreaseQuantity({{ $line->getKey() }})" class="flex size-9 items-center justify-center border-r border-zinc-200 text-sm dark:border-zinc-700" aria-label="Decrease {{ $line->variant->product->title }} quantity">-</button>
                                    {{ $line->quantity }}
                                    <button type="button" wire:click="increaseQuantity({{ $line->getKey() }})" class="flex size-9 items-center justify-center border-l border-zinc-200 text-sm dark:border-zinc-700" aria-label="Increase {{ $line->variant->product->title }} quantity">+</button>

                                <flux:button wire:click="removeLine({{ $line->getKey() }})" variant="ghost" size="sm" icon="trash" aria-label="Remove {{ $line->variant->product->title }}" />

                @endforeach

                    Subtotal
                    <x-storefront.price :amount="$subtotal" :currency="$cart->currency" />

                <flux:button wire:click="checkout" variant="primary" class="w-full">
                    Checkout
                </flux:button>

        @endif

</flux:modal>


Output:
Chunk ID: e3114f
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 1154
Output:
<flux:modal name="cart-drawer" class="md:w-[32rem]">

                <flux:heading size="lg">Cart</flux:heading>
                <flux:text class="mt-1">{{ $lineCount }} {{ Str::plural('item', $lineCount) }}</flux:text>

            <flux:button :href="route('cart.show')" wire:navigate variant="subtle" size="sm" icon="shopping-bag">
                View cart
            </flux:button>

        @if ($lines->isEmpty())

                <flux:icon name="shopping-bag" class="mx-auto size-10 text-zinc-400 dark:text-zinc-600" />

Your cart is empty.

                <flux:button :href="route('collections.index')" wire:navigate variant="primary" class="mt-5">
                    Browse products
                </flux:button>

        @else

                @foreach ($lines as $line)

getKey() }}">
                        variant->product->handle) }}" wire:navigate class="flex size-16 shrink-0 items-center justify-center rounded-md border border-zinc-200 bg-zinc-100 text-zinc-400 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-600">
                            <flux:icon name="shopping-bag" class="size-6" />

                                    variant->product->handle) }}" wire:navigate class="line-clamp-2 text-sm font-medium text-zinc-950 hover:underline dark:text-white">
                                        {{ $line->variant->product->title }}

                                        {{ $line->variant->optionValues->map(fn ($value) => $value->option->name.': '.$value->value)->implode(' / ') ?: ($line->variant->sku ?: 'Default') }}

                                <x-storefront.price :amount="$line->line_total_amount" :currency="$cart->currency" class="justify-end text-sm" />

                                    <button type="button" wire:click="decreaseQuantity({{ $line->getKey() }})" class="flex size-9 items-center justify-center border-r border-zinc-200 text-sm dark:border-zinc-700" aria-label="Decrease {{ $line->variant->product->title }} quantity">-</button>
                                    {{ $line->quantity }}
                                    <button type="button" wire:click="increaseQuantity({{ $line->getKey() }})" class="flex size-9 items-center justify-center border-l border-zinc-200 text-sm dark:border-zinc-700" aria-label="Increase {{ $line->variant->product->title }} quantity">+</button>

                                <flux:button wire:click="removeLine({{ $line->getKey() }})" variant="ghost" size="sm" icon="trash" aria-label="Remove {{ $line->variant->product->title }}" />

                @endforeach

                    Subtotal
                    <x-storefront.price :amount="$subtotal" :currency="$cart->currency" />

                <flux:button wire:click="checkout" variant="primary" class="w-full">
                    Checkout
                </flux:button>

        @endif

</flux:modal>


sed -n '1,240p' tests/Feature/Storefront/CartCheckoutUiTest.php

<?php

use App\Enums\CartStatus;
use App\Enums\CheckoutStatus;
use App\Livewire\Storefront\Account\Auth\Login as CustomerLogin;
use App\Livewire\Storefront\Cart\Show as CartShow;
use App\Livewire\Storefront\Checkout\Show as CheckoutShow;
use App\Livewire\Storefront\Products\Show as ProductShow;
use App\Models\Cart;
use App\Models\Checkout;
use App\Models\Customer;
use App\Models\InventoryItem;
use App\Models\Product;
use App\Models\ProductVariant;
use App\Models\ShippingRate;
use App\Models\Store;
use App\Services\CartService;
use Database\Seeders\DatabaseSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;

uses(RefreshDatabase::class);

beforeEach(function () {
    $this->withoutVite();
    $this->seed(DatabaseSeeder::class);
});

function storefrontUiStore(): Store
{
    $store = Store::query()->where('handle', 'acme-fashion')->firstOrFail();
    app()->instance('current_store', $store);

    return $store;
}

function storefrontUiVariant(Store $store): ProductVariant
{
    $product = Product::withoutGlobalScopes()
        ->where('store_id', $store->getKey())
        ->where('handle', 'classic-cotton-t-shirt')
        ->firstOrFail();

    return ProductVariant::withoutGlobalScopes()
        ->where('product_id', $product->getKey())
        ->oldest('position')
        ->firstOrFail();
}

test('product detail add to cart persists a session cart', function () {
    $store = storefrontUiStore();
    $variant = storefrontUiVariant($store);

    Livewire::test(ProductShow::class, ['handle' => 'classic-cotton-t-shirt'])
        ->set('quantity', 2)
        ->call('addToCart')
        ->assertDispatched('cart-updated');

    $cart = Cart::withoutGlobalScopes()->findOrFail(session('cart_id'));

    expect($cart->store_id)->toBe($store->getKey())
        ->and($cart->lines()->withoutGlobalScopes()->where('variant_id', $variant->getKey())->first()?->quantity)->toBe(2);
});

test('cart page updates and removes line quantities', function () {
    $store = storefrontUiStore();
    $variant = storefrontUiVariant($store);
    $cart = app(CartService::class)->create($store);
    session(['cart_id' => $cart->getKey()]);
    $line = app(CartService::class)->addLine($cart, $variant->getKey(), 2);

    Livewire::test(CartShow::class)
        ->assertSee('Classic Cotton T-Shirt')
        ->call('increaseQuantity', $line->getKey())
        ->assertDispatched('cart-updated');

    expect($line->refresh()->quantity)->toBe(3);

    Livewire::test(CartShow::class)
        ->call('removeLine', $line->getKey())
        ->assertDispatched('cart-updated');

    expect($cart->lines()->withoutGlobalScopes()->count())->toBe(0);
});

test('customer login merges an existing guest cart without creating empty carts', function () {
    $store = storefrontUiStore();
    $variant = storefrontUiVariant($store);
    $customer = Customer::withoutGlobalScopes()
        ->where('store_id', $store->getKey())
        ->where('email', 'customer@acme.test')
        ->firstOrFail();
    $customerCart = app(CartService::class)->create($store, $customer);
    $guestCart = app(CartService::class)->create($store);
    session(['cart_id' => $guestCart->getKey()]);

    app(CartService::class)->addLine($customerCart, $variant->getKey(), 1);
    app(CartService::class)->addLine($guestCart, $variant->getKey(), 2);

    Livewire::test(CustomerLogin::class)
        ->set('email', 'customer@acme.test')
        ->set('password', 'password')
        ->call('login');

    expect($guestCart->refresh()->status)->toBe(CartStatus::Abandoned)
        ->and($customerCart->refresh()->lines()->withoutGlobalScopes()->where('variant_id', $variant->getKey())->first()?->quantity)->toBe(2)
        ->and(Cart::withoutGlobalScopes()->where('store_id', $store->getKey())->count())->toBe(2);
});

test('checkout page progresses through address shipping discount and payment selection', function () {
    $store = storefrontUiStore();
    $variant = storefrontUiVariant($store);
    $cart = app(CartService::class)->create($store);
    session(['cart_id' => $cart->getKey()]);
    app(CartService::class)->addLine($cart, $variant->getKey(), 2);

    $rate = ShippingRate::withoutGlobalScopes()
        ->whereHas('zone', fn ($query) => $query->withoutGlobalScopes()->where('store_id', $store->getKey()))
        ->where('name', 'Standard Shipping')
        ->firstOrFail();

    Livewire::test(CheckoutShow::class)
        ->set('email', 'buyer@example.test')
        ->set('shippingAddress.first_name', 'Test')
        ->set('shippingAddress.last_name', 'Buyer')
        ->set('shippingAddress.address1', 'Main Street 1')
        ->set('shippingAddress.city', 'Berlin')
        ->set('shippingAddress.country', 'DE')
        ->set('shippingAddress.postal_code', '10115')
        ->call('saveAddress')
        ->assertSet('step', 'shipping')
        ->set('selectedShippingRateId', $rate->getKey())
        ->call('selectShippingMethod')
        ->assertSet('step', 'payment')
        ->set('discountCode', 'SAVE10')
        ->call('applyDiscount')
        ->assertHasNoErrors()
        ->set('paymentMethod', 'credit_card')
        ->call('selectPaymentMethod')
        ->assertSet('step', 'reserved');

    $checkout = Checkout::withoutGlobalScopes()->where('cart_id', $cart->getKey())->firstOrFail();
    $inventory = InventoryItem::withoutGlobalScopes()->where('variant_id', $variant->getKey())->firstOrFail();

    expect($checkout->status)->toBe(CheckoutStatus::PaymentSelected)
        ->and($checkout->discount_code)->toBe('SAVE10')
        ->and($checkout->totals_json['discount'])->toBeGreaterThan(0)
        ->and($inventory->quantity_reserved)->toBe(2);
});


Output:
Chunk ID: 310ed3
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 1423
Output:
<?php

use App\Enums\CartStatus;
use App\Enums\CheckoutStatus;
use App\Livewire\Storefront\Account\Auth\Login as CustomerLogin;
use App\Livewire\Storefront\Cart\Show as CartShow;
use App\Livewire\Storefront\Checkout\Show as CheckoutShow;
use App\Livewire\Storefront\Products\Show as ProductShow;
use App\Models\Cart;
use App\Models\Checkout;
use App\Models\Customer;
use App\Models\InventoryItem;
use App\Models\Product;
use App\Models\ProductVariant;
use App\Models\ShippingRate;
use App\Models\Store;
use App\Services\CartService;
use Database\Seeders\DatabaseSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;

uses(RefreshDatabase::class);

beforeEach(function () {
    $this->withoutVite();
    $this->seed(DatabaseSeeder::class);
});

function storefrontUiStore(): Store
{
    $store = Store::query()->where('handle', 'acme-fashion')->firstOrFail();
    app()->instance('current_store', $store);

    return $store;
}

function storefrontUiVariant(Store $store): ProductVariant
{
    $product = Product::withoutGlobalScopes()
        ->where('store_id', $store->getKey())
        ->where('handle', 'classic-cotton-t-shirt')
        ->firstOrFail();

    return ProductVariant::withoutGlobalScopes()
        ->where('product_id', $product->getKey())
        ->oldest('position')
        ->firstOrFail();
}

test('product detail add to cart persists a session cart', function () {
    $store = storefrontUiStore();
    $variant = storefrontUiVariant($store);

    Livewire::test(ProductShow::class, ['handle' => 'classic-cotton-t-shirt'])
        ->set('quantity', 2)
        ->call('addToCart')
        ->assertDispatched('cart-updated');

    $cart = Cart::withoutGlobalScopes()->findOrFail(session('cart_id'));

    expect($cart->store_id)->toBe($store->getKey())
        ->and($cart->lines()->withoutGlobalScopes()->where('variant_id', $variant->getKey())->first()?->quantity)->toBe(2);
});

test('cart page updates and removes line quantities', function () {
    $store = storefrontUiStore();
    $variant = storefrontUiVariant($store);
    $cart = app(CartService::class)->create($store);
    session(['cart_id' => $cart->getKey()]);
    $line = app(CartService::class)->addLine($cart, $variant->getKey(), 2);

    Livewire::test(CartShow::class)
        ->assertSee('Classic Cotton T-Shirt')
        ->call('increaseQuantity', $line->getKey())
        ->assertDispatched('cart-updated');

    expect($line->refresh()->quantity)->toBe(3);

    Livewire::test(CartShow::class)
        ->call('removeLine', $line->getKey())
        ->assertDispatched('cart-updated');

    expect($cart->lines()->withoutGlobalScopes()->count())->toBe(0);
});

test('customer login merges an existing guest cart without creating empty carts', function () {
    $store = storefrontUiStore();
    $variant = storefrontUiVariant($store);
    $customer = Customer::withoutGlobalScopes()
        ->where('store_id', $store->getKey())
        ->where('email', 'customer@acme.test')
        ->firstOrFail();
    $customerCart = app(CartService::class)->create($store, $customer);
    $guestCart = app(CartService::class)->create($store);
    session(['cart_id' => $guestCart->getKey()]);

    app(CartService::class)->addLine($customerCart, $variant->getKey(), 1);
    app(CartService::class)->addLine($guestCart, $variant->getKey(), 2);

    Livewire::test(CustomerLogin::class)
        ->set('email', 'customer@acme.test')
        ->set('password', 'password')
        ->call('login');

    expect($guestCart->refresh()->status)->toBe(CartStatus::Abandoned)
        ->and($customerCart->refresh()->lines()->withoutGlobalScopes()->where('variant_id', $variant->getKey())->first()?->quantity)->toBe(2)
        ->and(Cart::withoutGlobalScopes()->where('store_id', $store->getKey())->count())->toBe(2);
});

test('checkout page progresses through address shipping discount and payment selection', function () {
    $store = storefrontUiStore();
    $variant = storefrontUiVariant($store);
    $cart = app(CartService::class)->create($store);
    session(['cart_id' => $cart->getKey()]);
    app(CartService::class)->addLine($cart, $variant->getKey(), 2);

    $rate = ShippingRate::withoutGlobalScopes()
        ->whereHas('zone', fn ($query) => $query->withoutGlobalScopes()->where('store_id', $store->getKey()))
        ->where('name', 'Standard Shipping')
        ->firstOrFail();

    Livewire::test(CheckoutShow::class)
        ->set('email', 'buyer@example.test')
        ->set('shippingAddress.first_name', 'Test')
        ->set('shippingAddress.last_name', 'Buyer')
        ->set('shippingAddress.address1', 'Main Street 1')
        ->set('shippingAddress.city', 'Berlin')
        ->set('shippingAddress.country', 'DE')
        ->set('shippingAddress.postal_code', '10115')
        ->call('saveAddress')
        ->assertSet('step', 'shipping')
        ->set('selectedShippingRateId', $rate->getKey())
        ->call('selectShippingMethod')
        ->assertSet('step', 'payment')
        ->set('discountCode', 'SAVE10')
        ->call('applyDiscount')
        ->assertHasNoErrors()
        ->set('paymentMethod', 'credit_card')
        ->call('selectPaymentMethod')
        ->assertSet('step', 'reserved');

    $checkout = Checkout::withoutGlobalScopes()->where('cart_id', $cart->getKey())->firstOrFail();
    $inventory = InventoryItem::withoutGlobalScopes()->where('variant_id', $variant->getKey())->firstOrFail();

    expect($checkout->status)->toBe(CheckoutStatus::PaymentSelected)
        ->and($checkout->discount_code)->toBe('SAVE10')
        ->and($checkout->totals_json['discount'])->toBeGreaterThan(0)
        ->and($inventory->quantity_reserved)->toBe(2);
});


sed -n '1,120p' resources/views/components/storefront/price.blade.php


sed -n '1,120p' resources/views/components/storefront/price.blade.php

@props([
    'amount',
    'currency' => 'EUR',
    'compareAt' => null,
])

class('inline-flex flex-wrap items-baseline gap-2') }}>
    {{ \App\Support\Money::format((int) $amount, $currency) }}

    @if ($compareAt && $compareAt > $amount)
        {{ \App\Support\Money::format((int) $compareAt, $currency) }}
    @endif


Output:
Chunk ID: a2f57d
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 124
Output:
@props([
    'amount',
    'currency' => 'EUR',
    'compareAt' => null,
])

class('inline-flex flex-wrap items-baseline gap-2') }}>
    {{ \App\Support\Money::format((int) $amount, $currency) }}

    @if ($compareAt && $compareAt > $amount)
        {{ \App\Support\Money::format((int) $compareAt, $currency) }}
    @endif


sed -n '1,160p' app/ValueObjects/DiscountResult.php && sed -n '1,160p' app/ValueObjects/PricingResult.php


sed -n '1,160p' app/ValueObjects/DiscountResult.php && sed -n '1,160p' app/ValueObjects/PricingResult.php

PricingResult.php

<?php

namespace App\ValueObjects;

final readonly class DiscountResult
{
    /**
     * @param  array<int, int>  $allocations
     */
    public function __construct(
        public int $amount,
        public array $allocations,
        public bool $freeShipping = false,
    ) {}
}
<?php

namespace App\ValueObjects;

final readonly class PricingResult
{
    /**
     * @param  array<int, TaxLine>  $taxLines
     */
    public function __construct(
        public int $subtotal,
        public int $discount,
        public int $shipping,
        public array $taxLines,
        public int $taxTotal,
        public int $total,
        public string $currency,
    ) {}

    /**
     * @return array{subtotal: int, discount: int, shipping: int, tax_lines: array<int, array{name: string, rate: int, amount: int}>, tax: int, total: int, currency: string}
     */
    public function toArray(): array
    {
        return [
            'subtotal' => $this->subtotal,
            'discount' => $this->discount,
            'shipping' => $this->shipping,
            'tax_lines' => array_map(fn (TaxLine $line): array => $line->toArray(), $this->taxLines),
            'tax' => $this->taxTotal,
            'total' => $this->total,
            'currency' => $this->currency,
        ];
    }
}


Output:
Chunk ID: c3857e
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 324
Output:
<?php

namespace App\ValueObjects;

final readonly class DiscountResult
{
    /**
     * @param  array<int, int>  $allocations
     */
    public function __construct(
        public int $amount,
        public array $allocations,
        public bool $freeShipping = false,
    ) {}
}
<?php

namespace App\ValueObjects;

final readonly class PricingResult
{
    /**
     * @param  array<int, TaxLine>  $taxLines
     */
    public function __construct(
        public int $subtotal,
        public int $discount,
        public int $shipping,
        public array $taxLines,
        public int $taxTotal,
        public int $total,
        public string $currency,
    ) {}

    /**
     * @return array{subtotal: int, discount: int, shipping: int, tax_lines: array<int, array{name: string, rate: int, amount: int}>, tax: int, total: int, currency: string}
     */
    public function toArray(): array
    {
        return [
            'subtotal' => $this->subtotal,
            'discount' => $this->discount,
            'shipping' => $this->shipping,
            'tax_lines' => array_map(fn (TaxLine $line): array => $line->toArray(), $this->taxLines),
            'tax' => $this->taxTotal,
            'total' => $this->total,
            'currency' => $this->currency,
        ];
    }
}


rg -n "flux:field|wire:submit|flux:select|flux:input" resources/views/livewire/storefront resources/views/livewire/admin -g '*.blade.php' | head -80


rg -n "flux:field|wire:submit|flux:select|flux:input" resources/views/livewire/storefront resources/views/livewire/admin -g '*.blade.php' | head -80

rg -n 'flux:field|wire:submit|flux:select|flux:input' resources/views/livewire/storefront resources/views/livewire/admin -g '*.blade.php'

Question: flux:field|wire:submit|flux:select|flux:input

resources/views/livewire/admin/products/index.blade.php:14:        <flux:input wire:model.live.debounce.300ms="search" icon="magnifying-glass" placeholder="Search products..." aria-label="Search products" />
resources/views/livewire/admin/products/index.blade.php:16:        <flux:select wire:model.live="statusFilter" aria-label="Status filter">
resources/views/livewire/admin/products/index.blade.php:17:            <flux:select.option value="all">All statuses</flux:select.option>
resources/views/livewire/admin/products/index.blade.php:18:            <flux:select.option value="active">Active</flux:select.option>
resources/views/livewire/admin/products/index.blade.php:19:            <flux:select.option value="draft">Draft</flux:select.option>
resources/views/livewire/admin/products/index.blade.php:20:            <flux:select.option value="archived">Archived</flux:select.option>
resources/views/livewire/admin/products/index.blade.php:21:        </flux:select>
resources/views/livewire/admin/products/index.blade.php:23:        <flux:select wire:model.live="typeFilter" aria-label="Product type filter">
resources/views/livewire/admin/products/index.blade.php:24:            <flux:select.option value="all">All types</flux:select.option>
resources/views/livewire/admin/products/index.blade.php:26:                <flux:select.option value="{{ $type }}">{{ $type }}</flux:select.option>
resources/views/livewire/admin/products/index.blade.php:28:        </flux:select>
resources/views/livewire/storefront/account/auth/login.blade.php:4:    <form wire:submit="login" class="flex flex-col gap-6">
resources/views/livewire/storefront/account/auth/login.blade.php:5:        <flux:input
resources/views/livewire/storefront/account/auth/login.blade.php:15:        <flux:input
resources/views/livewire/storefront/search/index.blade.php:13:        <flux:input wire:model.live.debounce.300ms="q" icon="magnifying-glass" placeholder="Search products..." aria-label="Search products" />
resources/views/livewire/admin/inventory/index.blade.php:8:        <flux:input wire:model.live.debounce.300ms="search" icon="magnifying-glass" placeholder="Search by product or SKU..." aria-label="Search inventory" />
resources/views/livewire/admin/inventory/index.blade.php:10:        <flux:select wire:model.live="stockFilter" aria-label="Stock filter">
resources/views/livewire/admin/inventory/index.blade.php:11:            <flux:select.option value="all">All stock</flux:select.option>
resources/views/livewire/admin/inventory/index.blade.php:12:            <flux:select.option value="low">Low stock</flux:select.option>
resources/views/livewire/admin/inventory/index.blade.php:13:            <flux:select.option value="out">Out of stock</flux:select.option>
resources/views/livewire/admin/inventory/index.blade.php:14:        </flux:select>
resources/views/livewire/admin/collections/index.blade.php:14:        <flux:input wire:model.live.debounce.300ms="search" icon="magnifying-glass" placeholder="Search collections..." aria-label="Search collections" />
resources/views/livewire/admin/collections/index.blade.php:16:        <flux:select wire:model.live="statusFilter" aria-label="Status filter">
resources/views/livewire/admin/collections/index.blade.php:17:            <flux:select.option value="all">All statuses</flux:select.option>
resources/views/livewire/admin/collections/index.blade.php:18:            <flux:select.option value="active">Active</flux:select.option>
resources/views/livewire/admin/collections/index.blade.php:19:            <flux:select.option value="draft">Draft</flux:select.option>
resources/views/livewire/admin/collections/index.blade.php:20:            <flux:select.option value="archived">Archived</flux:select.option>
resources/views/livewire/admin/collections/index.blade.php:21:        </flux:select>
resources/views/livewire/admin/collections/form.blade.php:16:    <form wire:submit="save" class="grid gap-6 lg:grid-cols-[minmax(0,2fr)_minmax(280px,1fr)]">
resources/views/livewire/admin/collections/form.blade.php:20:                    <flux:input wire:model.live.debounce.300ms="title" label="Title" placeholder="Summer Collection" />
resources/views/livewire/admin/collections/form.blade.php:23:                    <flux:input wire:model="handle" label="Handle" placeholder="summer-collection" />
resources/views/livewire/admin/collections/form.blade.php:34:                    <flux:input wire:model.live.debounce.300ms="productSearch" icon="magnifying-glass" label="Search products" placeholder="Search products..." />
resources/views/livewire/admin/collections/form.blade.php:77:                <flux:select wire:model="status" label="Status">
resources/views/livewire/admin/collections/form.blade.php:78:                    <flux:select.option value="draft">Draft</flux:select.option>
resources/views/livewire/admin/collections/form.blade.php:79:                    <flux:select.option value="active">Active</flux:select.option>
resources/views/livewire/admin/coll…1777 chars truncated…lux:select>
resources/views/livewire/admin/products/form.blade.php:22:    <form wire:submit="save" class="grid gap-6 lg:grid-cols-[minmax(0,2fr)_minmax(280px,1fr)]">
resources/views/livewire/admin/products/form.blade.php:26:                    <flux:input wire:model.live.debounce.300ms="title" label="Title" placeholder="Short Sleeve T-Shirt" />
resources/views/livewire/admin/products/form.blade.php:57:                                        <flux:input wire:model="variants.{{ $index }}.sku" aria-label="Variant SKU" />
resources/views/livewire/admin/products/form.blade.php:60:                                        <flux:input wire:model="variants.{{ $index }}.price" type="number" step="0.01" min="0" aria-label="Variant price" />
resources/views/livewire/admin/products/form.blade.php:63:                                        <flux:input wire:model="variants.{{ $index }}.compareAtPrice" type="number" step="0.01" min="0" aria-label="Compare at price" />
resources/views/livewire/admin/products/form.blade.php:66:                                        <flux:input wire:model="variants.{{ $index }}.quantity" type="number" min="0" aria-label="Variant quantity" />
resources/views/livewire/admin/products/form.blade.php:87:                            <flux:input wire:model="options.{{ $index }}.name" label="Option name" placeholder="Size" />
resources/views/livewire/admin/products/form.blade.php:88:                            <flux:input wire:model="options.{{ $index }}.values" label="Values" placeholder="S, M, L, XL" />
resources/views/livewire/admin/products/form.blade.php:103:                    <flux:select wire:model="status" label="Status">
resources/views/livewire/admin/products/form.blade.php:104:                        <flux:select.option value="draft">Draft</flux:select.option>
resources/views/livewire/admin/products/form.blade.php:105:                        <flux:select.option value="active">Active</flux:select.option>
resources/views/livewire/admin/products/form.blade.php:106:                        <flux:select.option value="archived">Archived</flux:select.option>
resources/views/livewire/admin/products/form.blade.php:107:                    </flux:select>
resources/views/livewire/admin/products/form.blade.php:109:                    <flux:input wire:model="handle" label="URL handle" placeholder="short-sleeve-t-shirt" />
resources/views/livewire/admin/products/form.blade.php:116:                    <flux:input wire:model="vendor" label="Vendor" placeholder="Acme Basics" />
resources/views/livewire/admin/products/form.blade.php:117:                    <flux:input wire:model="productType" label="Product type" placeholder="T-Shirts" />
resources/views/livewire/admin/products/form.blade.php:118:                    <flux:input wire:model="tags" label="Tags" placeholder="new, cotton, sale" />
resources/views/livewire/storefront/account/auth/register.blade.php:4:    <form wire:submit="register" class="flex flex-col gap-6">
resources/views/livewire/storefront/account/auth/register.blade.php:5:        <flux:input
resources/views/livewire/storefront/account/auth/register.blade.php:14:        <flux:input
resources/views/livewire/storefront/account/auth/register.blade.php:23:        <flux:input
resources/views/livewire/storefront/account/auth/register.blade.php:32:        <flux:input
resources/views/livewire/storefront/checkout/show.blade.php:34:                <form wire:submit="saveAddress" class="rounded-lg border border-zinc-200 bg-white p-5 dark:border-zinc-800 dark:bg-zinc-950">
resources/views/livewire/storefront/checkout/show.blade.php:48:                            <flux:input wire:model="email" type="email" label="Email" />
resources/views/livewire/storefront/checkout/show.blade.php:52:                        <flux:input wire:model="shippingAddress.first_name" label="First name" />
resources/views/livewire/storefront/checkout/show.blade.php:53:                        <flux:input wire:model="shippingAddress.last_name" label="Last name" />
resources/views/livewire/storefront/checkout/show.blade.php:56:                            <flux:input wire:model="shippingAddress.address1" label="Address" />
resources/views/livewire/storefront/checkout/show.blade.php:61:                            <flux:input wire:model="shippingAddress.address2" label="Apartment, suite, etc." />
resources/views/livewire/storefront/checkout/show.blade.php:64:                        <flux:input wire:model="shippingAddress.city" label="City" />
resources/views/livewire/storefront/checkout/show.blade.php:65:                        <flux:input wire:model="shippingAddress.postal_code" label="Postal code" />
resources/views/livewire/storefront/checkout/show.blade.php:67:                        <flux:input wire:model="shippingAddress.province_code" label="Region code" placeholder="DE-BE" />
resources/views/livewire/storefront/checkout/show.blade.php:68:                        <flux:select wire:model="shippingAddress.country" label="Country">


Output:
Chunk ID: 332d18
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 2945
Output:
resources/views/livewire/admin/products/index.blade.php:14:        <flux:input wire:model.live.debounce.300ms="search" icon="magnifying-glass" placeholder="Search products..." aria-label="Search products" />
resources/views/livewire/admin/products/index.blade.php:16:        <flux:select wire:model.live="statusFilter" aria-label="Status filter">
resources/views/livewire/admin/products/index.blade.php:17:            <flux:select.option value="all">All statuses</flux:select.option>
resources/views/livewire/admin/products/index.blade.php:18:            <flux:select.option value="active">Active</flux:select.option>
resources/views/livewire/admin/products/index.blade.php:19:            <flux:select.option value="draft">Draft</flux:select.option>
resources/views/livewire/admin/products/index.blade.php:20:            <flux:select.option value="archived">Archived</flux:select.option>
resources/views/livewire/admin/products/index.blade.php:21:        </flux:select>
resources/views/livewire/admin/products/index.blade.php:23:        <flux:select wire:model.live="typeFilter" aria-label="Product type filter">
resources/views/livewire/admin/products/index.blade.php:24:            <flux:select.option value="all">All types</flux:select.option>
resources/views/livewire/admin/products/index.blade.php:26:                <flux:select.option value="{{ $type }}">{{ $type }}</flux:select.option>
resources/views/livewire/admin/products/index.blade.php:28:        </flux:select>
resources/views/livewire/storefront/account/auth/login.blade.php:4:    <form wire:submit="login" class="flex flex-col gap-6">
resources/views/livewire/storefront/account/auth/login.blade.php:5:        <flux:input
resources/views/livewire/storefront/account/auth/login.blade.php:15:        <flux:input
resources/views/livewire/storefront/search/index.blade.php:13:        <flux:input wire:model.live.debounce.300ms="q" icon="magnifying-glass" placeholder="Search products..." aria-label="Search products" />
resources/views/livewire/admin/inventory/index.blade.php:8:        <flux:input wire:model.live.debounce.300ms="search" icon="magnifying-glass" placeholder="Search by product or SKU..." aria-label="Search inventory" />
resources/views/livewire/admin/inventory/index.blade.php:10:        <flux:select wire:model.live="stockFilter" aria-label="Stock filter">
resources/views/livewire/admin/inventory/index.blade.php:11:            <flux:select.option value="all">All stock</flux:select.option>
resources/views/livewire/admin/inventory/index.blade.php:12:            <flux:select.option value="low">Low stock</flux:select.option>
resources/views/livewire/admin/inventory/index.blade.php:13:            <flux:select.option value="out">Out of stock</flux:select.option>
resources/views/livewire/admin/inventory/index.blade.php:14:        </flux:select>
resources/views/livewire/admin/collections/index.blade.php:14:        <flux:input wire:model.live.debounce.300ms="search" icon="magnifying-glass" placeholder="Search collections..." aria-label="Search collections" />
resources/views/livewire/admin/collections/index.blade.php:16:        <flux:select wire:model.live="statusFilter" aria-label="Status filter">
resources/views/livewire/admin/collections/index.blade.php:17:            <flux:select.option value="all">All statuses</flux:select.option>
resources/views/livewire/admin/collections/index.blade.php:18:            <flux:select.option value="active">Active</flux:select.option>
resources/views/livewire/admin/collections/index.blade.php:19:            <flux:select.option value="draft">Draft</flux:select.option>
resources/views/livewire/admin/collections/index.blade.php:20:            <flux:select.option value="archived">Archived</flux:select.option>
resources/views/livewire/admin/collections/index.blade.php:21:        </flux:select>
resources/views/livewire/admin/collections/form.blade.php:16:    <form wire:submit="save" class="grid gap-6 lg:grid-cols-[minmax(0,2fr)_minmax(280px,1fr)]">
resources/views/livewire/admin/collections/form.blade.php:20:                    <flux:input wire:model.live.debounce.300ms="title" label="Title" placeholder="Summer Collection" />
resources/views/livewire/admin/collections/form.blade.php:23:                    <flux:input wire:model="handle" label="Handle" placeholder="summer-collection" />
resources/views/livewire/admin/collections/form.blade.php:34:                    <flux:input wire:model.live.debounce.300ms="productSearch" icon="magnifying-glass" label="Search products" placeholder="Search products..." />
resources/views/livewire/admin/collections/form.blade.php:77:                <flux:select wire:model="status" label="Status">
resources/views/livewire/admin/collections/form.blade.php:78:                    <flux:select.option value="draft">Draft</flux:select.option>
resources/views/livewire/admin/collections/form.blade.php:79:                    <flux:select.option value="active">Active</flux:select.option>
resources/views/livewire/admin/collections/form.blade.php:80:                    <flux:select.option value="archived">Archived</flux:select.option>
resources/views/livewire/admin/collections/form.blade.php:81:                </flux:select>
resources/views/livewire/admin/auth/login.blade.php:4:    <form wire:submit="login" class="flex flex-col gap-6">
resources/views/livewire/admin/auth/login.blade.php:5:        <flux:input
resources/views/livewire/admin/auth/login.blade.php:15:        <flux:input
resources/views/livewire/storefront/collections/show.blade.php:27:                        <flux:input wire:model.live.debounce.500ms="minPrice" type="number" min="0" placeholder="Min" aria-label="Minimum price" />
resources/views/livewire/storefront/collections/show.blade.php:28:                        <flux:input wire:model.live.debounce.500ms="maxPrice" type="number" min="0" placeholder="Max" aria-label="Maximum price" />
resources/views/livewire/storefront/collections/show.blade.php:56:                <flux:select wire:model.live="sort" aria-label="Sort products" class="sm:max-w-56">
resources/views/livewire/storefront/collections/show.blade.php:57:                    <flux:select.option value="featured">Featured</flux:select.option>
resources/views/livewire/storefront/collections/show.blade.php:58:                    <flux:select.option value="price_asc">Price: Low to High</flux:select.option>
resources/views/livewire/storefront/collections/show.blade.php:59:                    <flux:select.option value="price_desc">Price: High to Low</flux:select.option>
resources/views/livewire/storefront/collections/show.blade.php:60:                    <flux:select.option value="newest">Newest</flux:select.option>
resources/views/livewire/storefront/collections/show.blade.php:61:                </flux:select>
resources/views/livewire/admin/products/form.blade.php:22:    <form wire:submit="save" class="grid gap-6 lg:grid-cols-[minmax(0,2fr)_minmax(280px,1fr)]">
resources/views/livewire/admin/products/form.blade.php:26:                    <flux:input wire:model.live.debounce.300ms="title" label="Title" placeholder="Short Sleeve T-Shirt" />
resources/views/livewire/admin/products/form.blade.php:57:                                        <flux:input wire:model="variants.{{ $index }}.sku" aria-label="Variant SKU" />
resources/views/livewire/admin/products/form.blade.php:60:                                        <flux:input wire:model="variants.{{ $index }}.price" type="number" step="0.01" min="0" aria-label="Variant price" />
resources/views/livewire/admin/products/form.blade.php:63:                                        <flux:input wire:model="variants.{{ $index }}.compareAtPrice" type="number" step="0.01" min="0" aria-label="Compare at price" />
resources/views/livewire/admin/products/form.blade.php:66:                                        <flux:input wire:model="variants.{{ $index }}.quantity" type="number" min="0" aria-label="Variant quantity" />
resources/views/livewire/admin/products/form.blade.php:87:                            <flux:input wire:model="options.{{ $index }}.name" label="Option name" placeholder="Size" />
resources/views/livewire/admin/products/form.blade.php:88:                            <flux:input wire:model="options.{{ $index }}.values" label="Values" placeholder="S, M, L, XL" />
resources/views/livewire/admin/products/form.blade.php:103:                    <flux:select wire:model="status" label="Status">
resources/views/livewire/admin/products/form.blade.php:104:                        <flux:select.option value="draft">Draft</flux:select.option>
resources/views/livewire/admin/products/form.blade.php:105:                        <flux:select.option value="active">Active</flux:select.option>
resources/views/livewire/admin/products/form.blade.php:106:                        <flux:select.option value="archived">Archived</flux:select.option>
resources/views/livewire/admin/products/form.blade.php:107:                    </flux:select>
resources/views/livewire/admin/products/form.blade.php:109:                    <flux:input wire:model="handle" label="URL handle" placeholder="short-sleeve-t-shirt" />
resources/views/livewire/admin/products/form.blade.php:116:                    <flux:input wire:model="vendor" label="Vendor" placeholder="Acme Basics" />
resources/views/livewire/admin/products/form.blade.php:117:                    <flux:input wire:model="productType" label="Product type" placeholder="T-Shirts" />
resources/views/livewire/admin/products/form.blade.php:118:                    <flux:input wire:model="tags" label="Tags" placeholder="new, cotton, sale" />
resources/views/livewire/storefront/account/auth/register.blade.php:4:    <form wire:submit="register" class="flex flex-col gap-6">
resources/views/livewire/storefront/account/auth/register.blade.php:5:        <flux:input
resources/views/livewire/storefront/account/auth/register.blade.php:14:        <flux:input
resources/views/livewire/storefront/account/auth/register.blade.php:23:        <flux:input
resources/views/livewire/storefront/account/auth/register.blade.php:32:        <flux:input
resources/views/livewire/storefront/checkout/show.blade.php:34:                <form wire:submit="saveAddress" class="rounded-lg border border-zinc-200 bg-white p-5 dark:border-zinc-800 dark:bg-zinc-950">
resources/views/livewire/storefront/checkout/show.blade.php:48:                            <flux:input wire:model="email" type="email" label="Email" />
resources/views/livewire/storefront/checkout/show.blade.php:52:                        <flux:input wire:model="shippingAddress.first_name" label="First name" />
resources/views/livewire/storefront/checkout/show.blade.php:53:                        <flux:input wire:model="shippingAddress.last_name" label="Last name" />
resources/views/livewire/storefront/checkout/show.blade.php:56:                            <flux:input wire:model="shippingAddress.address1" label="Address" />
resources/views/livewire/storefront/checkout/show.blade.php:61:                            <flux:input wire:model="shippingAddress.address2" label="Apartment, suite, etc." />
resources/views/livewire/storefront/checkout/show.blade.php:64:                        <flux:input wire:model="shippingAddress.city" label="City" />
resources/views/livewire/storefront/checkout/show.blade.php:65:                        <flux:input wire:model="shippingAddress.postal_code" label="Postal code" />
resources/views/livewire/storefront/checkout/show.blade.php:67:                        <flux:input wire:model="shippingAddress.province_code" label="Region code" placeholder="DE-BE" />
resources/views/livewire/storefront/checkout/show.blade.php:68:                        <flux:select wire:model="shippingAddress.country" label="Country">


sed -n '1,260p' resources/views/livewire/storefront/checkout/show.blade.php