// NO LONGER ON COTTON (CIRCLE 2, cfc1e46c6f + 4ad9aab410; SHELL DRAW 3, 28 Nov 2026): `circle.list`'s section `gone`// holds the people whose account was erased (`state: "left"`, "Left Cotton") and those whose number now leads to// another account (`state: "changed"`, "This number belongs to someone else on Cotton now"), each row with its `number`// and `detail`, the core's words. Comms says that `detail` where it shows such a person: in place of their chat row's// last line, and under the name in their chat's header. Read when the list is read and when a chat opens; a person// chat's number is asked (`chat.contact`) only while someone is gone. Android: messages ChatModel.readGone.importCottonKitimportSwiftUI@MainActor@ObservablefinalclassChatCircleGone {staticlet shared = ChatCircleGone()/// The core's words by number (E.164), for the people no longer on Cotton.private(set) var gone: [String: String] = [:]/// Each person chat's number, asked only while someone is gone.private(set) var numbers: [String: String] = [:] @ObservationIgnored privatevar readAt: Date?/// The core's words for `thread` when its person is no longer on Cotton, else nil.func words(_ thread: String) -> String? {guard !gone.isEmpty, let number = numbers[thread] else { returnnil }return gone[Self.key(number)] }/// Who is no longer on Cotton; while anyone is, the numbers of the person chats in `threads` not yet known.func read(threads: [String]) async {guardlet core = (ChatBooks.shared as? CoreChatBook)?.core else { return }// The list asks the object, so once a minute at most however often the chat list is read again.if readAt.map({ Date().timeIntervalSince($0) > 60 }) ?? true { readAt = Date()guardlet list = try? await core.callJSON("circle.list") else { return } gone = Self.of(list) }guard !gone.isEmpty else { return }for thread in threads where numbers[thread] == nil {iflet contact = try? await core.callJSON("chat.contact", ["thread": thread]), let number = contact["number"]?.string { numbers[thread] = number } } }/// The `gone` rows of a `circle.list` answer, by number; empty when signed out, unreachable or none. nonisolated staticfunc of(_ list: JSONValue) -> [String: String] {guardcase .array(let sections)? = list["sections"] else { return [:] }var out: [String: String] = [:]for section in sections where section["id"]?.string == "gone" {guardcase .array(let rows)? = section["rows"] else { continue }for row in rows {guardlet number = row["number"]?.string, !number.isEmpty, let words = row["detail"]?.string, !words.isEmpty else { continue } out[key(number)] = words } }return out }/// A number as the core writes it in `circle.list` (`+` and digits), for a lookup. nonisolated staticfunc key(_ number: String) -> String { number.filter { $0.isNumber || $0 == "+" } }}