import { Plus, Trash2 } from "lucide-react" import { Button } from "../ui/button" import { Input } from "../ui/input" import { Textarea } from "../ui/textarea" import { addBlankSegment, addTextSegment, addWordBankItem, defaultSelectMissingWordsResponseFromStimulus, parseSelectMissingWordsResponseSlotValue, parseSelectMissingWordsStimulusSlotValue, removeSegment, removeWordBankItem, SELECT_MISSING_WORDS_MIN_BANK, serializeSelectMissingWordsResponseSlotValue, serializeSelectMissingWordsStimulusSlotValue, setAllowReuse, syncResponseBlanksWithStimulus, updateTextSegment, updateWordBankText, type SelectMissingWordsStimulusValue, } from "../../lib/selectMissingWordsSlotValue" export function DynamicSelectMissingWordsStimulusSlot({ value, onChange, disabled, slotLabel, }: { value: string onChange: (next: string) => void disabled: boolean slotLabel: string }) { const parsed = parseSelectMissingWordsStimulusSlotValue(value) const updateValue = (next: SelectMissingWordsStimulusValue) => { onChange(serializeSelectMissingWordsStimulusSlotValue(next)) } const canRemoveWord = parsed.word_bank.length > SELECT_MISSING_WORDS_MIN_BANK const canRemoveSegment = parsed.segments.length > 1 return (

Passage segments

{parsed.segments.map((segment, index) => (
{segment.type === "text" ? (

Text