// The voice split on Home: a line spoken to the record button, run (`SpokenHome` says where it// goes; this does it): the fan turns, a page opens, another database is// chosen, the record on top comes down, or a command's record opens. False// when the line goes nowhere, and the dock keeps it as a thought.importCottonKitimportSwiftUI@MainActorstructHomeVoice {let definitions: TableDefinitions/// The fan's tiles; empty on a grid Home.let fan: [(key: String, name: String)]/// The databases a spoken line may choose, as their caps name them.let choosable: [(id: String, name: String)]let core: (any CottonCalling)?let navigator: Navigator?/// The tile the fan turns to.let show: Binding<String?>?let scene: DatabaseScene?let databases: DatabasesModel?/// Runs the line; false when it goes nowhere (a thought).func run(_ words: String) async -> Bool { await did(words) != nil }/// Runs the line and says what happened, in the thought definition's/// voice lines ("Opened People"); nil when the line goes nowhere.func did(_ words: String) async -> String? {let lines = VoiceWords.reading(definitions)switchawaitSpokenHome.goes( words, definitions: definitions, fan: fan, databases: choosable, find: { [core] inawaitSpokenHome.find($0, core: core) }, command: { [core] inawaitSpokenHome.command($0, core: core) }) {case .turn(let key)?:// Whatever was pushed over Home closes; each card keeps its own stack. navigator?.popToRoot() show?.wrappedValue = keyreturn lines.opened(fan.first { $0.key == key }?.name ?? key)case .open(let route, let name)?: navigator?.open(route)return lines.opened(name)case .database(let id, let tile)?:// The tile turns once the chosen database's fan is up. show?.wrappedValue = tileawaitDatabaseCapRow.choose(id, scene: scene, in: databases)return lines.opened(choosable.first { $0.id == id }?.name ?? id)case .back?: navigator?.pop()return lines.backcase .ran(let made)?:iflet made { navigator?.open(made) }return lines.rancasenil: returnnil } }}