{{!-- entry --}}
{{#each spellGroups as |group rank|}}
<header data-filter-value="{{group.filterValue}}">
    <div class="name">{{localize group.label}}</div>
    {{#if group.focusPool}}
    <div class="controls" data-section="focus-points" data-tooltip="PF2E.Focus.label">
        {{> (@root.partial 'slider') group.focusPool}}
    </div>
    {{/if}}
</header>
{{!-- spell --}}
{{#each group.slotSpells}}
<div class="item{{#if isVirtual}} virtual{{/if}}{{#if disabled}} inactive{{/if}}"
    data-item-type="spell{{#if isVirtual}}-slot-group{{/if}}" data-item-id="{{spell.id}}"
    data-entry-id="{{entryId}}" data-cast-rank="{{castRank}}" data-group-id="{{groupId}}" {{#if
    isPrepared}}data-slot-id="{{slotId}}" {{/if}} {{#if expended}}data-slot-expended{{/if}}
    {{#unless isRitual}} draggable="true" {{/unless}} data-filter-value="{{filterValue}}">
    {{!-- image --}}
    {{> (@root.partial 'item-image') spell}}
    {{!-- details --}}
    <div class="details">
        {{!-- name --}}
        <div class="name">
            {{#if signature}}
            <a data-action="toggle-signature">
                <i class="fa-{{ifThen signature.toggled 'solid' 'regular'}} fa-star signature"></i>
            </a>
            {{/if}}
            <a data-action="item-description">{{spell.name}}</a>
        </div>
        {{!-- extras --}}
        <div class="extras" data-tooltip-direction="DOWN">
            {{!-- category --}}
            {{#if isRitual}}
            <div class="cast">
                {{spell.system.time.value}}
            </div>
            {{else}}
            <div data-section="category" data-tooltip="{{{entryTooltip}}}">
                <i class="{{category.icon}}"></i> {{{actionGlyph spell.system.time.value}}}
            </div>
            {{/if}}
            {{!-- actions --}}
            <div class="actions">
                {{!-- is not primary vessel --}}
                {{#if untrainedVessel}}
                {{{untrainedVessel}}}
                {{!-- if broken --}}
                {{else if isBroken}}
                <div class="broken" data-tooltip="{{@root.i18n.path 'broken'}}">
                    <i class="fa-solid fa-link-slash broken"></i>
                </div>
                {{!-- not broken or untrained --}}
                {{else}}
                {{!-- if uses --}}
                {{#if uses}}
                <div {{#if uses.hasMaxUses}}class="numbers" {{/if}}>
                    <input class="small" type="number"
                        {{#if isStaff}}
                            data-staff-charges
                        {{else}}
                            data-item-id="{{uses.itemId}}"
                            {{#if uses.ruleIndex includeZero=true}}
                            data-rule-index="{{uses.ruleIndex}}"
                            {{else}}
                            data-item-property="{{uses.property}}"
                            {{/if}}
                        {{/if}}
                        value="{{uses.value}}" min="0" max="{{uses.max}}" placeholder="0">
                    {{#if uses.hasMaxUses}}
                    <span class="slash"> / </span>
                    <input class="small" type="number" value="{{uses.max}}" placeholder="0"
                        disabled />
                    {{/if}}
                </div>
                {{else if canTogglePrepared}}
                <a data-action="toggle-slot-expended"
                    data-tooltip="{{#if expended}}PF2E.RestoreSpellTitle{{else}}PF2E.ExpendSpellTitle{{/if}}">
                    <i
                        class="fa-solid fa-fw fa-{{#if expended}}plus{{else}}minus{{/if}}-square"></i>
                </a>
                {{/if}}
                {{!-- must equip --}}
                {{#if annotation}}
                <a data-action="draw-item" data-parent-id="{{parentId}}" {{{annotation.dataset}}}
                    data-tooltip="{{localize annotation.label}} {{actionGlyph annotation.cost}}">
                    <i class="fa-solid fa-hand-back-fist"></i>
                </a>
                {{!-- parent of virtual unequipped --}}
                {{else if unequipped}}
                <span class="unequipped" data-tooltip="pf2e-toolbelt.actionable.cast.equipped">
                    <i class="fa-solid fa-shirt"></i>
                </span>
                {{!-- equipped --}}
                {{else}}
                {{!-- cast spell --}}
                <a {{#if expended}}class="disabled cast" {{else}}data-action="cast-spell"
                    class="cast" {{/if}} {{{@root.i18n.tooltip 'cast' }}}>
                    <i class="fa-solid fa-play"></i>
                </a>
                {{/if}}
                {{/if}}
            </div>
        </div>
    </div>
</div>
{{/each}}
{{/each}}
