discord-jadx/app/src/main/java/com/discord/widgets/chat/input/WidgetChatInputAutocomplete...

54 lines
4.2 KiB
Java

package com.discord.widgets.chat.input;
import com.discord.api.sticker.Sticker;
import com.discord.models.commands.ApplicationCommand;
import com.discord.models.commands.ApplicationCommandOption;
import com.discord.widgets.chat.input.applicationcommands.WidgetChatInputModelMappingFunctions;
import com.discord.widgets.chat.input.autocomplete.Autocompletable;
import com.discord.widgets.chat.input.autocomplete.LeadingIdentifier;
import com.discord.widgets.chat.input.models.AutocompleteInputSelectionModel;
import com.discord.widgets.chat.input.models.InputSelectionModel;
import com.discord.widgets.chat.input.models.MentionToken;
import d0.z.d.m;
import d0.z.d.o;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
/* compiled from: WidgetChatInputAutocomplete.kt */
public final class WidgetChatInputAutocomplete$configureDataSubscriptions$11 extends o implements Function1<InputSelectionModel, Unit> {
public final /* synthetic */ WidgetChatInputAutocomplete this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public WidgetChatInputAutocomplete$configureDataSubscriptions$11(WidgetChatInputAutocomplete widgetChatInputAutocomplete) {
super(1);
this.this$0 = widgetChatInputAutocomplete;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(InputSelectionModel inputSelectionModel) {
invoke(inputSelectionModel);
return Unit.a;
}
public final void invoke(InputSelectionModel inputSelectionModel) {
if (inputSelectionModel.getSelection().getLast() <= inputSelectionModel.getInputModel().getInput().length()) {
WidgetChatInputModelMappingFunctions widgetChatInputModelMappingFunctions = WidgetChatInputModelMappingFunctions.INSTANCE;
ApplicationCommand selectedCommand = inputSelectionModel.getInputModel().getInputCommandContext().getSelectedCommand();
ApplicationCommandOption selectedCommandOption = inputSelectionModel.getSelectedCommandOption();
InputSelectionModel access$getLastChatInputModel$p = WidgetChatInputAutocomplete.access$getLastChatInputModel$p(this.this$0);
Set<ApplicationCommandOption> errorsToShowForCommandParameters = widgetChatInputModelMappingFunctions.getErrorsToShowForCommandParameters(selectedCommand, selectedCommandOption, access$getLastChatInputModel$p != null ? access$getLastChatInputModel$p.getSelectedCommandOption() : null, inputSelectionModel.getInputModel().getInputCommandOptions().getCommandOptionValidity(), inputSelectionModel.getInputModel().getInputCommandOptions().getValues());
WidgetChatInputAutocomplete.access$applyCommandOptionSpans(this.this$0, inputSelectionModel.getInputModel(), inputSelectionModel.getSelectedCommandOption(), errorsToShowForCommandParameters);
MentionToken mentionAutoCompleteToken = widgetChatInputModelMappingFunctions.getMentionAutoCompleteToken(inputSelectionModel.getInputModel().getInput(), inputSelectionModel.getSelection(), inputSelectionModel.getSelectedCommandOption(), inputSelectionModel.hasSelectedFreeformInputOption(), inputSelectionModel.getInputModel().getInputCommandOptions());
m.checkNotNullExpressionValue(inputSelectionModel, "model");
Map<LeadingIdentifier, List<Autocompletable>> filterMentionsForCommandContext = widgetChatInputModelMappingFunctions.filterMentionsForCommandContext(inputSelectionModel);
List<Sticker> stickerMatches = widgetChatInputModelMappingFunctions.getStickerMatches(mentionAutoCompleteToken);
WidgetChatInputAutocomplete.access$setLastChatInputModel$p(this.this$0, inputSelectionModel);
WidgetChatInputAutocomplete.access$getAutocompleteInputSelectionModelSubject$p(this.this$0).onNext(new AutocompleteInputSelectionModel(mentionAutoCompleteToken, filterMentionsForCommandContext, inputSelectionModel, errorsToShowForCommandParameters, stickerMatches));
}
}
}