/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type SortedMap } from "@elaraai/east"; import { type BuilderFrameDock } from "@elaraai/east-ui-components"; import { type SourceShown } from "../shared/schedule/source-tab.js"; import type { AllocationCommands } from "./actions.js"; import { type AllocationDrag, type LibraryGrip, type Verdict } from "./drag.js"; import { type AllocationStyles, type AllocationValue, type Context, type Day, type FitResult, type Load, type ResourceLine, type Selection, type TimeStep } from "./model.js"; import { type Nouns } from "./nouns.js"; /** What the viewer picked in the Library (A9, A10): a card to book or reserve, or an arrival whose bins it highlights. */ export type Pick = LibraryGrip | { kind: "bins"; arrival: string; }; /** The Arrivals groups' kinds (A51): what a card's look and the overdue mark go by, whatever the app calls them. */ type ArrivalKind = "overdue" | "ready" | "removed" | "allocated"; /** * A hold as a card writes it. * * @param step - The hold * @returns `8 d`, `12 h` */ export declare function holdText(step: TimeStep): string; /** One Arrivals card (A51): what it shows, and what a click or a drag does with it. */ export interface ArrivalCard { /** Its key in the Arrivals list: `arrival:LD-2231`, or `removed:3113`. */ key: string; /** Its group's words, the board's. */ group: string; /** Its group's kind. */ kind: ArrivalKind; /** The arrival's key. */ arrival: string; /** A card that drags: an arrival to book, or a removed bin to book again. */ grip: Extract | undefined; /** An Allocated card's bins, in time order. */ bins: string[]; /** An Allocated card whose every bin is a draft: its × returns it (A51). */ draft: boolean; label: string; /** Its quantity: `21 m³`. */ figure: string; /** Its meta and its hold: `BRK · R2 · spec MC12 · 8 d`. */ sub: string; /** Its ready line, in warn when it is overdue or a bin of it is not linked. */ ready: { text: string; tone?: "warning" | undefined; } | undefined; /** Its tooltip (A83). */ tip: string; /** What the search finds it by. */ search: string; } /** What the Library's cards are written from. */ export interface LibraryWords { nouns: Nouns; layout: "timeline" | "table"; /** A lane's label. */ lane: (key: string) => string; /** A quantity with the board's unit, and without. */ quantity: (value: number) => string; number: (value: number) => string; } /** * The Arrivals cards (A51), in their groups' order: the arrivals still to * book — Overdue (due before the plan day), then Ready around now — each with * its ready line; the day's committed bins the drafts removed (Removed from * plan, `was B-1 06:15 on K-203`); and the arrivals the day books (Allocated, * `in B-1 06:15 on K-203` or `2 bins · …`), the draft bookings first, then by * their first bin's time. * * @param args - The day as drafted and as the record holds it, and the words * @returns The cards, in order */ export declare function arrivalCards(args: { context: Context; day: Date; plan: Day; held: Day | undefined; words: LibraryWords; }): ArrivalCard[]; /** One Resources card (A52). */ export interface ResourceCard { key: string; group: string; label: string; /** What it takes: `20–40 m³`. */ figure: string; /** Its meta, or its group. */ sub: string; /** Its line today, over max in danger, held into its next job in warn. */ line: { text: string; tone?: "warning" | "danger" | undefined; }; tip: string; search: string; } /** * The Resources cards (A52), grouped by the day's states — free, then loading * (by their first bin's time), then busy — each its line: `31 m³ today · to Tue * 18` with `· 4 m³ over` or `· 1 d into next job`, `busy until Fri 14`, `free · * next job Wed 19`, `free · no next job`. * * @param args - Every resource, its load and its line, the drafts, and the words * @returns The cards, in order */ export declare function resourceCards(args: { resources: AllocationValue["resources"]; plan: Day; loads: SortedMap; lines: ReadonlyMap; words: LibraryWords; }): ResourceCard[]; /** A Find a fit's result in the Resources tab (A74): its bin, the chip's words, the fit's answer, and whether that answer is on its way. */ export interface ResourceFind { /** The bin it finds a fit for. */ bin: string; /** What it finds a fit for, as the chip says it: `LD-2210 · 4 m³`. */ label: string; /** The fit's answer for the drafts as they are, which the tab shows; `undefined` while it is on its way, or failed. */ shown: FitResult | undefined; /** Whether that answer is on its way: the tab is busy, showing what the rail shows, and no verdict (F2). */ busy: boolean; } /** * The resources a fit's answer says fit, best first — its scores, ties kept in * the tab's order: the fit ranks, never the board (F4). * * @param cards - The cards the rail shows, in the tab's order * @param answer - The fit's answer * @returns The cards that fit, best first */ export declare function foundCards(cards: readonly C[], answer: FitResult): C[]; /** The Library's args. */ export interface LibraryArgs { value: AllocationValue; context: Context; day: Date; plan: Day; held: Day | undefined; loads: SortedMap; lines: ReadonlyMap; styles: AllocationStyles; layout: "timeline" | "table"; narrow: boolean; drag: AllocationDrag; commands: AllocationCommands; selection: Selection | undefined; pick: Pick | undefined; /** A click on a card to book (A9): it picks it, or unpicks it. */ onArrival: (grip: Extract) => void; /** A click on a resource's card (A9): it picks it for the selected free slot, or selects it. */ onResource: (resource: string) => void; /** A click on an Allocated card (A10): its first bin selected, every bin of it highlighted. */ onAllocated: (arrival: string, bins: readonly string[]) => void; /** The picked card's action ran its verdict: what it refused, if anything. */ onVerdict: (verdict: Verdict) => void; /** The open tab, the host's: Find a fit opens Resources (A74). */ tab: string; onTab: (tab: string) => void; /** What the rail shows of each tab's source: the arrivals' and the resources'. */ shown: { arrivals: SourceShown; resources: SourceShown; }; /** A Find a fit's result, shown in the Resources tab until its chip clears it (A74). */ find?: ResourceFind | undefined; onClearFind?: (() => void) | undefined; /** Whether the Arrivals tab's count flashes (#1409): the latest run booked an arrival or returned one, and its highlight is on. */ arrivalsFlash?: boolean | undefined; } /** * The start pane (see the module docs). * * @param args - See {@link LibraryArgs} * @returns The pane, or `undefined` when the board has no Library */ export declare function useAllocationLibrary(args: LibraryArgs): BuilderFrameDock | undefined; export {}; //# sourceMappingURL=library.d.ts.map